for of loop was introduced in ES6 which allows you to easily iterate over elements of an collection.for of iterates over the values of elements of a collection not the keys. A collection can be an array, set, list, custom collection object etc.
Earlier to ES6 we had to use for loop or Array�s foreach loop to walk through elements of an collection. ES6 introduced a new way for iteration.
The following example is help you to read all the value from objects.
Syntax
Example
Example Program:- (Editor)

Editor is Loading...
Advertisement
Tags:
Earlier to ES6 we had to use for loop or Array�s foreach loop to walk through elements of an collection. ES6 introduced a new way for iteration.
The following example is help you to read all the value from objects.
Syntax
for (variable of array_or_object)
{
Statements;
}Example
for(i of ar_ob)
{
debugger;
alert("Name : "+i.name);
alert("Mark : "+i.mark);
}Example Program:- (Editor)
Editor is Loading...
Advertisement
RSS Feed
Twitter
04:08
Muhammad Kaif

Posted in
0 comments:
Post a Comment