Basics of JavaScript data types and variables

    1.JavaScript supports a variety of data types, such as numeric, text, and boolean types.

    2. The text is represented as a string, placed in the guide, and the quotation marks must be matched. Escape characters can

contain cannot be entered directly.

    3. Variables are JavaScript's way of holding data (such as numbers or strings) in memory so that they can be used

repeatedly .

    4. Variable names must not contain illegal characters, such as percent signs (%) and &, or JavaScript reserved words, such as

with.

    5. Before assigning a value to a variable, the existence of the variable must be declared to the JavaScript interpreter.

    6. JavaScript has 4 basic mathematical operators, namely addition (+), subtraction (-), multiplication (*), division (/). When assigning a calculation result to a

variable , use the equals (=) operator, also known as the assignment operator.

    7. Operators have different precedence, so multiplication and division will be calculated before addition and subtraction.

    8. The + operator can concatenate multiple strings into one long string. When you chain numbers and strings with the + operator,

JavaScript will automatically convert the numbers to strings.

    9. Although many times JavaScript can automatically convert data types. But sometimes you need to cast the type.

The parseInt() and parseFloat() functions can convert strings to numbers. For strings that cannot be converted, NaN will be

returned .

    10. An array is a special variable type that can hold multiple data that can be inserted and accessed through a unique

index .

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326634094&siteId=291194637