How to run JavaScript in sublime text

Source: Internet
Author: User
Tags sublime text

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

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.