Sublime Text 3 Debug Js__js

Source: Internet
Author: User
Tags sublime text

Today, just have a demand, that is, I want to use JS to write algorithms or their own learning JS functions and other knowledge, hope that the program can be written directly debugging, and not every time to use the browser to resolve, so specifically to search the data, and then refer to a number of articles after the final configuration success, so is to share experience ~ ~

I. Installation of Node.js

Of course, you can use other environment such as JSC to run JS, this article uses the Nodejs. First make sure your computer is Nodejs and added to the environment variable.

Download Address: https://nodejs.org/en/

Second, add this build System for sublime text

Just open Sublime Text and select Tools > Build System > New build System.

As shown in the figure:


Paste the content and save it.

{
    "cmd": ["Node", "--use-strict", "--harmony", "$file"],
    "selector": "Source.js"
}
In the above build file (Node.sublime-build), Node is executing the command,--harmony and--use-strict are execution parameters, $file is the current file name, So a build operation is actually equivalent to executing node--use-strict--harmony filename on the command line. --harmony indicates that ES Harmony features are enabled, and these features are currently only run in strict mode, so you need to add use-strict parameters at the same time.

Third, the test is installed successfully

1. Select the "Node" you just created in the Tools > Build System, and then create a new Test.js file.

My test code is as follows:

var a = 1;
var b = 2;
Console.log (A+B);

Using the shortcut key CTRL + B, you get the following execution results:

The above steps can be completed, and you can directly use sublime text for debugging.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.