js basic data types and variables

1. The basic data type
Number. Numeric type (not distinguish between integers, and decimal), string type String, Bool Boolean (true / flase), null null type, undefind undefined, object type of an object,
2. Statement constants and variables
constants: You can not change the value of
variables: value can be changed
declare a variable need keyword var. Syntax var variable name space (custom) = "Content"
Example: var a = "hello js"
in programming a single assignment is not equal to the equal sign is the role stored data symbols to the right of the left variable
create variables : var = a request to the system memory a
definition of variables: a = 1 the number 1 assigned to the variables existing
statements and definitions: var a = 1;
the console.log (a) is output to the most common method of detection console (not one)
Alert ()
function: the contents of the output to the built-in syntax prompt box, this message box typically used for testing, pop-up on the page, not for the actual development, will temporarily block the operation of the program, knows the user clicks the prompt box determination will disappear, the program continues to run.
Syntax: alert (content)
typrof detection data type
Syntax: typeof + space + the detected data
console.log (typrof a);

Published 28 original articles · won praise 2 · Views 2075

Guess you like

Origin blog.csdn.net/weixin_46146313/article/details/104105353