JS introductory tutorial-01-Hello World

before the start

If you have never touched JS. Go to the following website and experience it for 5 minutes:

https://www.javascript.com/

Getting Started

browser based

JS is usually used in combination with HTML and CSS.

  • write hellojs.html

Use Notepad to create a new one hellojs.htmlwith the following content:

<!DOCTYPE html>
<html>
<body>
<script>
alert("hello js");
</script>
</body>
</html>
  • Effect view

Open this file directly with your browser.

You should see a pop-up box directly in the browser with the content "hello js".

Based on Node.js

For the grammar explanation of js, it is awkward to explain it together with html.

It is to use Node.js for code demonstration.

Node.js installation & usage

Baidu by yourself.

Or refer to:

Node.js

  • writejs-01-hello.js

Written in any editor, the content is as follows:

console.log("hello js");
  • run
$ node js-01-hello.js
hello js

Directory Navigation

Directory Navigation

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324874591&siteId=291194637