In console mode, the browser can not only edit but also run JS.
Most of the scenes, we are all in the IDE to edit the save and then open the preview effect in the browser.
In the field of Web front-end, sublime text became my favorite in editing JavaScript, which was repeated in the previous scene.
Today, I learned a trick on YouTube, editing and running JavaScript in sublime text.
Preparation materials:
1: First have to install the sublime, I chose the 2 version, after all, python2 the beginning of the syntax is more familiar with, you can modify and try to develop some plug-ins. Sublime3 plug-ins Some new APIs have to be python3 under development.
2: Install Nodejs (previous post two forced installation Nodejs)
Start setting:
Get the file
Editor: Note here that Nodejs has been installed under the/usr/local/bin/folder above
and then save
At this point through the terminal can see our files have been added and the path added
Then we write a program that makes an integer factorization
Some concepts:
Prime: a natural number greater than 1, except 1 and itself, which cannot be divisible by other natural numbers ( prime Numbers )
Factorization: The product of breaking a number into several primes
Ideas:
The factorization of an integer is to find all of its prime factors
First, find a number that will divide the number of the dependent
Second, if this number is prime, save this number
Thirdly, continue to divide the quotient obtained by Prime factor
Code implementation
Save it anywhere, and then press set the current compilation environment to Nodejs
The last step is to press the shortcut key command + B to run the program
End!
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
How to run JavaScript in sublime text