-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray6.html
More file actions
39 lines (31 loc) · 720 Bytes
/
Array6.html
File metadata and controls
39 lines (31 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<h3> demo on for in loop and for of loop(new features came in ECMA script(js6))</h3>
<script>
let a=[11,22,33];
for(let i in a){
document.write(`${i}=> ${a[i]}<br>`);
a[i]+=5;
}
let b=[44,5,66,88,45];
for(let e of b){
document.write(`${e}<br>`);
}
let str='welcome';
for(let c of str)
{
document.write(`${c}<br>`);
}
for(let c in str)
{
document.write(`${c} => ${str[c]}<br>`);
}
</script>
<!-- for (old)
for in => for(tempvar in arr/coll) fetching one by one index
{
statements
}
for of =>
for(tempvar of arr/coll) fetching one by one value(element)
{
statements
}