You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/01-hello-world/article.md
+16-17Lines changed: 16 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,16 @@
1
1
# Hello, world!
2
2
3
-
This part of the tutorial is about core JavaScript, the language itself.
3
+
這部份的教學是關於 JavaScript 的核心,討論的是這個語言自身。
4
4
5
-
But we need a working environment to run our scripts and, since this book is online, the browser is a good choice. We'll keep the amount of browser-specific commands (like`alert`) to a minimum so that you don't spend time on them if you plan to concentrate on another environment (like Node.js). We'll focus on JavaScript in the browser in the [next part](/ui) of the tutorial.
So first, let's see how we attach a script to a webpage. For server-side environments (like Node.js), you can execute the script with a command like `"node my.js"`.
The `<script>`tag has a few attributes that are rarely used nowadays but can still be found in old code:
45
+
`<script>`標籤尚有一些不常用的屬性,你可以在陳年的程式碼中見到它們:
47
46
48
-
The `type`attribute: <code><script <u>type</u>=...></code>
49
-
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML standard totally changed the meaning of this attribute. Now, it can be used for JavaScript modules. But that's an advanced topic; we'll talk about modules in another part of the tutorial.
The `language`attribute: <code><script <u>language</u>=...></code>
52
-
: This attribute was meant to show the language of the script. This attribute no longer makes sense because JavaScript is the default language. There is no need to use it.
0 commit comments