For loops are available in most languages. There are several different uses of the For loop in JavaScript, as described below
Loop statements are often used in program implementations, where for loops are available in most languages. There are several different uses of the For loop in JavaScript, and here's what I understand separately. The first: (Usually, cyclic execution of related operations) code is as follows: Var obja=document.getelementsbytagname ("a"); var I,max; for (i=0,max=obja.length;i<max;i++) {obja[i].onclick=function () {alert (this.innerhtml); }} loop, and then register the Hyperlink tab by clicking the second: (For objects, manipulating object content) The code is as follows: Var person={name: ' Wmhello ', Age: ' 28 '}; var tips= '; for (Var obj on person) {tips+=obj+ '--> ' +person[obj]+ ' n '} alert (Tips) The third: (commonly used in arrays, which perform specific operations on an array) the code is as follows: Var num=[ 1,3,5]; var total=0; Num.foreach (function (e) {total+=e; }); Alert (total); This foreach loop works in Firefox and Chrome