Here is a summary of some of the more easily forgotten but in the future work required knowledge points.
1-Three Mesh
var a=3;
/*if (a%2==0)
{
Alert (' Even-numbered ');
}
Else
{
Alert (' singular ');
}*/
A%2==0?alert (' Even-numbered '): alert (' singular ');
2-When we write, we often write to if (a) represents: When A is true, then when does it mean true?
True: true, not 0 digits, non-empty string, non-empty object
False: False, number 0, empty string, empty object, undefined
3-plus there's a place to note
Plus: 1. String Connection 2. Add numbers
Minus: 1. Subtraction of numbers
4-return
Use return to return the value we need.
The parameter arguments about the function
Function Show (A, B)
{
Alert (arguments[0]);//equivalent to a
}
The magical use of arguments: By this method, if I have many parameters, I can directly introduce arguments to manipulate the data.
6-Intermediate insert \ Delete substitution for arrays
var arr=[1,2,3,4,5,6,7,8];
1. Intermediate Delete
/*arr.splice (2, 3);
Alert (arr); */
2. Intermediate insertion
/*arr.splice (5, 0, ' A ', ' B ', ' C ');
Alert (arr); */
3. Replace
Arr.splice (1, 2, ' A ', ' B ');
Alert (arr);
7-break and Continue
#目标: For The Loop
var i=0;
for (i=0;i<5;i++)
{
if (i==2)
{
break;//terminating the entire cycle
continue;//terminates this cycle and continues the next cycle
}
alert (i);
}
7-for in
#目标: for arrays or objects
var obj={a:5, B:3, c:98};
var attr= ';
for (attr in obj)
{
Alert (attr+ ' = ' +obj[attr]);
}
8-json
#{} introduced, the form of a key-value pair
9-about undefined
/*
Undefined1. You really don't have a definition. 2. Although defined, but not given a value
*/
Primary front-End JS Basics