Minggu, 27 Januari 2019

Read Array Value Using For...Of Inward Javascript

     for of loop was introduced inwards ES6 which allows you lot to easily iterate over elements of an collection.for of iterates over the values of elements of a collection non the keys. Influenza A virus subtype H5N1 collection tin survive an array, set, list, custom collection object etc.

     Earlier to ES6 nosotros had to purpose for loop or Array’s foreach loop to walkthrough elements of an collection. ES6 introduced a novel means for iteration.

Syntax
     for (variable of array_or_object)
    {
       Statements;
    }


Example
     var ar = [2, 4, 5, 2, 7, 48, 234];

    for (i of ar)
    {
      alert(i);
    }


Example Program:- (Editor)


Editor is Loading...

Advertisement




Tags:
javascript for of inwards allinworld99, allinworld99 to read array value, javascript to read array value using for of inwards allinworld99

Tidak ada komentar:

Posting Komentar