1 /*2 * Case Sensitive3 * */4 5 //Use Strict mode6 functiondosomething () {7"Use Strict"//Plus this will tell the compiler to start strict mode8 //......9 }Ten One /* A * Data Type - * Undefined The only value of uninitialized or undefined variables is Undefined - * Null an empty reference the * Boolean True/false note conversions for other data types and Boolean data types - * Number value type do not go to compare the size of the floating-point data Infinity (-infinity), more than the range of values nan-> should return a numeric value without returning a value - * Numeric conversion number () parseint () parsefloat () - * String type conversion. toString () + * The object type is a key-value pair - * Method with object type + * Constructor Create a function of the current object A * hasOwnProperty (PropertyName) has a property at * ISPROPERTYOF (object) is a prototype of another object - * propertyisenumberable (PropertyName) can use For-in - * tolocalestring () - * toString () - * VALUEOF () - * You can use the TypeOf operator to get the type of the variable in * - * to * Undefined derived from null so alert (null = = undefined)->true + * - * */ the functionTestvartype () { * varA; $document.write (typeofa);//undefinedPanax Notoginsengdocument.write ("<br/>"); -document.write (typeofb);//undefined thedocument.write ("<br/>"); + A varc =NULL; thedocument.write (typeofc);//Object +document.write ("<br/>"); - $document.write (typeof false);// Number $document.write ("<br/>"); - -document.write (typeof"123");//string thedocument.write ("<br/>"); - Wuyi varD = {"1": 1}; thedocument.write (typeofD);//Object -document.write ("<br/>"); Wu - varE =dosomething; Aboutdocument.write (typeofe);//function $document.write ("<br/>"); - -document.write (NULL= = undefined);//true -document.write ("<br/>"); A +document.write ("MAX:" +number.max_value); thedocument.write ("<br/>"); -document.write ("MIN:" +number.min_value); $document.write ("<br/>"); the thedocument.write (IsNaN ("123"));//false thedocument.write ("<br/>"); thedocument.write (IsNaN ("Xixi"));//true cannot be converted to a number -document.write ("<br/>"); indocument.write (IsNaN (123));//false thedocument.write ("<br/>"); thedocument.write (IsNaN (d));//if the object is valueof first, not in ToString . Aboutdocument.write ("<br/>"); the}
1 /**2 * Created by Sherry on 15-7-7.3 */4 /*5 * Two ways to create an object6 * */7 functionCreateObject () {8 varperson =NewObject ();9Person.name = "ZLN";TenPerson.age = 26; One A //objects defined by literals do not call the object constructor - varPersonnew = { -Name: "ZLN", theAge:26 - }; -}
The basic concept of javascript