1: Process Control
if: else; the conditional statement satisfies the execution if inside; does not satisfy the execution else;
If.. ElseIf. Else The layer lookup does not meet the execution else;
for; loop
for; loop object's key;
While/do. While Executes when the condition is always satisfied; Do...while first execution and then judgment at least once;
Switch: Case: Default, Swith write condition to execute, neither satisfies execution of default;
Try: Catch: Finally The code executed in the try, which may have an exception. Once an exception is found, jump to catch execution immediately. Otherwise, the contents of the catch are not executed; finally will be executed;
Throw; throw create custom error; The
With statement can be conveniently used to refer to an existing property in a particular object, but cannot be used to add properties to an object. To create a new property for an object, you must explicitly refer to the object; For example: var people = {' name ': ' Itdsn ', ' age ':--' professional ': ' Webdeveloper '}
with (people) {var str = "Name:" + Nam E + "<br>"; str + = "Age:" + ages + "<br>"; str + = "Occupation:" + professional;document.write (str);}
2: Apply
Slideshow to poll for playback: here starting from 0;
Implementation principle:
Function () {
var max = Math.max.apply (Math, arguments);
Event Occurrence = index + +;
the location to which = (max + index% max)% Max;
}
implements Math.pow ();
function Pow (n1, n2) { var y = N1; for (var i = 1; i < n2; i++= n1*y; } return N1;}
lowercase letters to uppercase; implement toLowerCase;
function toLowerCase (str) { var reg =/[a-z]/; for (var i = 0; i < str.length; i++) { if= str.replace (str[i],string . fromCharCode (Str[i].charcodeat () +32)); }} return str;}
toLowerCase (' Aaaaaa123&&**az ');
Haha, after writing I found that I am good 2;
Can actually directly:
function toLowerCase (str) { returnfunction(w) {return String.fromCharCode (W.charcodeat ( ) (+32)});}
Determine if lowercase letters/uppercase letters/numbers and count them;
functionStatistical (str) {varUpper = 0, lower = 0, numbers = 0; for(vari = 0; i < str.length; i++) {if(Str[i].charcodeat () >= 97&& str[i].charcodeat () <= 122) {Lower++}Else if(Str[i].charcodeat () >= && str[i].charcodeat () <= 90) {Upper++; }Else{numbers++; }}return[Upper, lower, numbers];}
Converts the \ t in the string to two spaces;
function Transfrom (str) { return str.replace (/\\t/g, ' ') );}
Converts a numeric string into a number;
function Transnumber (str) { return + str.replace (/\d+/g, ');}
Finds characters that appear only once in a string;
function once (str) { var arr = []; for (var i = 0; i < str.length; i++) { if(Str.lastindexof (str[i]) = = = = S Tr.indexof (Str[i]) {Arr.push (str[i]); }} return arr;}
JavaScript basic Syntax &4