JavaScript Note BOM object (document type Object)
Dom Object (Browser object)
Variables are case-sensitive, multiple variables can be defined in the same row, middle use ', ' split JavaScript statements can be used at the end, or not, but recommended
Data type conversions: integer conversion strings get the data prototype, but the type changes whether the array is converted to a string to obtain the data or the prototype, but the type is also changed to convert the Boolean to a string or a data prototype, but the type is also changed function is also the prototype output when using {} After the defined type is converted, obtaining a data prototype that is not obtained is the "Object,object" number Conversion Summary: The string is converted into an integer if the string obtained is a number if an empty string is converted into a result that is 0 ordinary character converted Get all the Nan Boolean value really converted to 1 false conversion to 0null conversion is also a 0undefined conversion obtained is a Nan object conversion is all Yes Nanparseint Summary: Find the number from the first character until the non-digit cutoff, The result is the result of the conversion parsefloat Summary: From the first character to find the number and the first decimal point, until the non-digit and the second decimal point, the result is the conversion results only the bottom 7 values converted to a Boolean value conversion to false: 1. An empty string, 2.0,3.0.0,4. NaN5.false6.null7.undefined
Tags: blocks and tags, inline tags, inline tags
There are errors in the calculation of decimals in JavaScript, so JavaScript decimals cannot be calculated accurately and some common escape characters commonly used in large computational javascript \ n: newline \ ': single quote \ ': double quotation marks \ \ : Right-underlined arithmetic operator:% take-up + plus sign Both sides are numbers is calculated, plus two sides if the string and the number is the connection effect-minus * multiply/except + + + + principle: first operation in + + (first with the value to do something else, in doing itself + +) var num5++ First do after the self ++var ++num4 first oneself + + after doing other things- whether in front or after, are on their own basis to reduce 1++ and-if the variables in front, do something else, do their own + + or--pure number of operations (except + comparison operator:> greater than < less than = = = = = = = = = = = = = equals >= greater than or equal to <= less than equals = = Not equal to the logical operator:&& and and operations | | or OR operation! not non-operational ternary operator: var result = 4>3? ' True ': ' false ' if 4 is greater than 3 is true, no is a false assignment operator:
Foundation must be
Document---Documents (HTML page) get get Set set element---elements, label by--tag name--name Style-- Styles get label settings in JavaScript font capitalization cannot be used font-size error, because in JavaScript this name does not match the variable name, you need to remove the first letter of the line, change to such FontSize never operate directly on an object group, only a single Label object to set the style setTimeout single timer time1 = setTimeout (alert (' OK '), +) cleartimeout (time1) This is the SetInterval repeat timer that is used to clear a single timer time = SetInterval (Console.log (' OK '), + clearinterval) This is the Var that is used to clear the repeating timer Num =1switch (num) { Case 1: console.log (' aaa ') "Break" 2: alert (222)} This is equivalent to: function ine (num) { if (num = = 1) { alert (333) }else { alert (444)}}ine (num)
JavaScript Learning Notes