Javascript:
ECMAscript: Equivalent to translating computer to code interpreter
DOM Document Object Model---Documents get the entry of an element operation HTML page
BOM Browser Object Model Explorer window window Popup
Compatibility
ECMA has virtually no compatibility issues
DOM has some operations that are incompatible
BOM does not have compatibility issues (completely incompatible)
Variable
typeof a test data type
Number numeric type
string literal type
Boolean Burgen, False
function type
Document Object Type
Undefined:1. undefined
2. Define a value that is not given
Forcing type conversions
Parseint converting a string into a numeric coercion type convert an integer
A left-to-right scan string encounters a non-numeric immediate jump
{
Nan:not a number
parseint ("abc") =nan
Determine whether two Nan is equal:
cannot be used directly (Nan==nan)
Using function IsNaN
}
Parsefloat Convert to Decimal
Display Type conversions: parseint,parsefloat
Implicit type conversion: = = First conversion type and then comparison
Example: Var a=5;b= ' 5 '; alert (a==b)---->turn
var a= ' n '; var b= ' 5 '; alert (a+b);//1. String concatenation (direct stitching) 2. Number addition (forced type conversion)
Alert (A-B); Subtraction of numbers
Scope
Local variables and global variables
Closed Package
A child function uses a local variable of the parent function
Image matching:
Element.src.match (* * *)
Not math, but the match () method retrieves the specified value within a string, or finds a match for one or more regular expressions.
If document.write is executed after the document has finished loading, the entire HTML page will be overwritten:
Characteristics
JavaScript has a dynamic type. This means that the same variables can be used as different types to represent variable strings when both single and double quotation marks are available:
JavaScript has only one numeric type. Numbers can be with decimal points or without:
Object
The JavaScript object declares and represents the calling method. var square={height:50,width:80,name: "Yalis"};
Call: document.write (square.height);
document.write (square["height"])
Statement
var carname=new String;
var x= new number;
var y= new Boolean;
var cars= new Array;
var person= new Object;
Objects like struct types can access the properties and methods of an object (for...in)
Return statement application: You can exit a certain condition can be directly executed return;
difference between double equals and three equals sign
"=" Assignment
"= =" equals: Used for comparison, the judgment value is equal "= = =" All equals: For comparison, judging type and value
JavaScript Note One