1/syntax
A. Case-sensitive
B. identifier (the first character must be the letter/"_"/"$", the other can be the letter/"_"/"$"/number, cannot use keywords, reserved words), generally using the hump or underline split format
C. Comments://single-line comments,/* Multiline comments */
D. Strict mode: Enable mode: Top Add a line to compile the instruction code "use strict"; You can also add inside a function to specify that the function executes in strict mode
E. Statement: a semicolon; end, multiple statements combine blocks of code, with {} wrapped
2/keywords and reserved words
A set of characters for a specific purpose (keyword): break does instanceof typeof case Else new Var catch finally return void continue for switch W Hile Debugger Function This width default if throw delete in try
Possible as a keyword (reserved word): abstract enum int short Boolean export interface static byte extends long super char final Nati ve synchronized class float package throws const GOTO private transient implements protected volatile double I Nport public let yield eval arguments
3/variable
Loosely, used to hold any type of data
Define with the Var operator, and then initialize
A. Declare simultaneous initialization of E.g.:var msg = "This is a variable declaration";
B. First declare, then initialize E.g.:var msg; msg = "This is a variable declaration";
C. Declare multiple variables, separated by multiple semicolons e.g.:var MSG1 = "Msg1", MSG2 = "MSG2";
4/Data type
Simple data type (base data type): underfinded/null/boolean/number/string
Complex Data class type: Object
Methods for detecting basic data Types typeof, E.g.:typeof ("string"); You can also typeof "string"; This is an operator, not a function
underfined return "underfined"
Null/object returns "Object"
Boolean returns "Boolean"
Number returns "Number"
String returns "string"
Functions return "function"
[javascript| Basic concept] study notes