May 29, 2021 Article blog
JavaScript's getting started is syntax content, so you can follow up, and this article tells you the basic syntax of JavaScript
1, internal JS, we can define a <script > tag, <script > content is js code, can also be defined anywhere in the HTML page, but may affect the order of execution
2, external JS, or define a <script > through the src property to introduce external JS
Single-line comment://comment
Multi-line comments: / . . . comments . . .
Original data type:
number: integer, decimal, NaN
String: String, regardless of single double quotes
Boolean: Boolean value, true/false
null: An object is an empty placeholder
Undefined: Undefined, uninitialized variables default to undefined
var 变量名=初始化值
document.write(typeof(变量名))//null的类型是object
Monsoun operator:
++ -- +(正号)
binary operator:
+ - * / %
Assignment operator:
+= -= *= /=
Comparison operator:
< <= > >= == 类型相同直接比较,类型不同转换成相同类型后比较
=== 类型不同直接返回false
Logical operators:
&&(与) ||()或 !(非) 具有短路效果
Troundy operator:
a>b ?a:b
That's all the editor-in-chief has to say about JavaScript's basic syntax