The composition of javascript:
ECMAScript
BOM: Browser Object model
DOM: Document Object Model
Syntax for javascript:
JavaScript is a weakly typed language with no explicit data type, and when declaring a variable, you do not need to specify the type of the variable.
The declaration of a variable must use the keyword var.
Grammar:
var is a valid variable name.
Eg:var num=10 var x,y,z=1 x=10 (can not write Var direct declaration)
Data types for javascript:
Undefined (undefined type)
Null (NULL type)
Number (numeric type) (including integer and floating-point values)
String (String type)(enclosed in single or double quotes)
Boolean (Boolean type)(the return value is True or false)
Object
Specific data types for detecting variables in javascript: using the keyword typeof
Syntax: typeof (variable or value)
If the variable is a null type, or if the variable is a reference type (such as an object, function, array), the result of the type object is returned
syntax for creating arrays in JavaScript:
var array name =new array (size);
The size represents the number of elements in the array.
When accessing an array element, it is in the form of: array name [subscript]; Subscript starting from 0
Common properties and methods for arrays:
Property: Length Sets or returns the number of elements in the array
Method:
Join () adds a delimiter to split the elements in an array
Sort () sorts the array.
Push () adds one or more elements to the end of the array and returns the new length.
JavaScript Basics (i)