![]() ![]() ![]() The main difference between for.of and for.in is what they iterate over. Get a closer look at accuracy here.* const million = 1000000 įor (let i = arr.length i > 0 i-) įullName += details + ' ' // fullName: john doe *Disclaimer: console.time() result accuracy highly depends on your system configuration. Take an array with over 1 million items and execute for a loop. The most surprising thing is when I tested it on a local machine I started believing that for (reverse) is the fastest among all the for loops. There are plenty of options available in for loops, for, for(reverse), for.of, foreach, for.in, for.await. Modern JS gives you lots of ways to iterate or looping over your values.īut question is that do you really know which loop or iterate fits best according to your requirement. Loops have always been a big part of most programming languages. But, also vanilla JS has a large fan base. Not only JS frameworks like NodeJS, React, Angular Vue, etc. JavaScript is a new sensation of web development. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |