The three most basic data types in javascript: numeric, Text, Boolean.
Numeric types are divided into integers and floating-point numbers.
Text type is a character or string, placed in double quotation marks "" or single quotation mark "can be, if the string contains quotation marks, you can use the escape character, \ ' \", the other common escape characters: \ \ backslash, \ n line break, \ r carriage, \ t tab tab,\b backspace character, \f page break, \ XNN nn is a hexadecimal number that represents one character in the Latin-1 character set.
The Boolean type is divided into true and false.
The basic operators in JavaScript, including the self-increment decrement operators, are similar to C.
If you want to concatenate strings, use the + sign directly, for example:
var constring= "Hello" + "" + "world";
If you concatenate values and strings with +, JavaScript automatically converts the numeric values into strings.
A function that can convert a string to a numeric value:
parseint () and parsefloat ()
The two functions parse whether each character of the string is a valid number, and if so, return the corresponding value, otherwise stop the conversion and return the previously converted value.
For example: parseint ("123abc"), the statement returns 123, and stops when the letter A is resolved.
If you convert a string that does not contain any numbers, you get the result Nan, which means not a number.
There is a function isNaN () that checks whether a value is Nan and returns True and false.
Definition of the array:
var myarray = new Array (); var Myarray;myarray = new Array (); var myarray = new Array (6); var myarray = new Array ("Hello", 345, " Paul ", 1234 var myarray = new Array (); myarray[ 0] = "Hello" ;myarray[ 1 ] = 345;myarray[ 2] = "Paul" ;myarray[ 3] = 1234;
To create a multidimensional array, declare the elements of one array again as an array.
JavaScript Learning Notes data types and variables