1,javascript is a scripting language that is Object-and event-driven and has security performance;
Features of 2,javascript:
1) Add interactive events to HTML;
2) scripting language, similar to Java syntax;
3) Explanatory language, side execution side interpretation;
3, three ways to reference JavaScript in a Web page:
1) Add a script tag to the page;
2) referencing external JS files;
3) write directly in the HTML tag, <input type= "button" value= " onclick=" Javascript:alert ("welcome You"); />
4, Declaration and assignment of variables:
1) can be declared before the assignment;
2) Edge Declaration edge assignment;
3) do not declare direct assignment;
Recommendation: Variables are not declared error-prone, generally not recommended to use;
5, Data type:
Undefined,number (including integer and character), null,boolean,string (including single and double quotes),
6, String object:
1) Properties:
The string object. Length;
2) Method:
CharAt (index); : Returns the character specified as a position;
IndexOf (str, index);: Returns the position of the first occurrence of a specified string str in a string;
SUBSTRING (INDEX1,INDEX2): Returns a substring from index1 to Index2, and includes the corresponding character of the index index1, excluding index2 corresponding characters;
Split (): Splits a string into an array of strings;
7,typeof operator: Detects the return value type of a variable;
The return values are as follows:
Undefined,string,boolean,number,object (object in JavaScript, array, or null);
8, array:
To create an array: var fruit=new Array (size); Size is the total number of elements
Assigning values to an array:
1) var fruit=new Array ("Apple", "orange", "peach", "banana");
2) var fruit=new Array (4);
fruit[0]= "Apple", fruit[1]= "Orange", fruit[2]= "peach"; fruit[3]= "banana";
Access array: array name [subscript];
9, common methods and properties of arrays:
Property: Length; Sets or returns the number of elements in the array;
Method:
Join (): Places all the elements in the array in a string and separates them with a delimiter, such as a landline number;
Sort (): sorts the array;
Push (): Adds one or more elements to the end of the array and returns the new length;
10,break: all loops after termination;
Continue: Terminates the current loop and continues the next cycle;
A review of basic JavaScript knowledge