javascriptnode.jsforeachfor-of-loop

How to skip first iteration in javascript for-of loop


I know how to skip first iteration in javascript foreach loop

dataObject.slice(1).forEach((row) => {});

I want to know how to do the same thing using for of loop in javascript, please help me, thanks

for( const row of dataObject )


Solution

  • The same way you're skipping it with forEach - replace the dataObject expression with dataObject.slice(1).

    for( const row of dataObject.slice(1) )