While loop:
while (true) {}
Dead Loop:
while (true) {}
for (;;) {}
End Dead Loop:
while (true) {
if () {break; }
}
Examples of dead loops:
var aaa= "" while (true) { sea = prompt ("called Papa"); if (sea = = = "Papa") {break ; }}
View Code
Array:
Defining assignments using traversal
Array elements: Each item in an array
Array Length: The number of elements in the array (array name. length)
Array subscript (Index): The position of the array element in the array starts at 0
The array's subscript is the 0 element that is the first element of the array
Traversing for for
Common methods of arrays:
Push (); append one element at the end
Unshift (); Append an element in front of
Pop (); Delete last element
Shift (); Delete the first element
Iindexof (): Find the first occurrence of the position returned subscript not found return-1
LastindexOf (): Find the last occurrence of the position returned subscript not found return-1
Examples of arrays:
//Q: Admin Add user Information Select how many each of the Var aa=[];//is used to store user information Var bb= prompt ("How many Users");//fill in the number of user information var cc= "";// User information, for (var i=0; I<BB; i++) { = prompt ("user" + (i+1) + "Information"); = cc ; }alert (AA);
View Code
March 2018 20 Arrays