JavaScript for in and for of Loop
Want to understand Properly Plz see the video carefully on YouTube channel name is Adisma
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>for in ... and for of ... Loop introduced in 2015(ES6)</h1>
<script>
var myFriends = ["Seema", "Vandana","Reema", "Riyanshi", "Nitya"];
// console.log(myFriends.length);
///-------------------------
// for(let i = 0 ;i<=myFriends.length-1 ;i++){
// console.log(myFriends[i]);
// }
// for( let elements in myFriends){
// console.log(elements);
// }
for (let elements of myFriends) {
console.log(elements);
}
</script>
</body>
</html>
Comments
Post a Comment