Data type:
1. Numeric type (integer floating point floating point type)
2. String type (string)
3. Boolean type (only two values: true fasle)
String literal 1. Escape series:
Some symbols cannot be identified in JavaScript, and they can only be displayed correctly after escaping. For example:
' Single quotation mark
" Double quotation mark
n Line feed character
r Carriage return character
\ Backslash
Escape example:
Escaped example output:
hello
world (line breaks between hello and world)
2. String splicing The string splicing operator symbol is the plus sign (). When two strings are spliced, JavaScript will splice them into one string; when a When numbers and a string are spliced, JavaScript will splice them into a string; when two numbers are spliced, the operator will become an addition operator
String splicing example.
document.write("link" "nan"); // Concatenate two strings, output linknan
document.write("5" 100); // Concatenate a number and a string, output 5100
document.write(5 100); // Two Number splicing, output 105
3.typeof operator is used to determine the data type. 🎜>
Copy code
Composite data type
1. Variable
The value of the variable can be changed. Naming method: the first character must be. Letters or underscores are case-sensitive. Use var to declare variables.
var num = 5; // The variable name is "num" and the value is 5
var num = 5; // Initialized
var num; // Not initialized
When naming, please pay attention to case-sensitivity. Do not use reserved words or names that are too long and difficult to remember; avoid using two similar variable names; in the program Start by declaring all variables.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn