This article was created to share some knowledge on ES6 features, alongside some usage samples.
Here I will create a small sample of an array to be accessed by For in and For of loops.
I will receive this result if I go through the array using For In loop.
We can observe that, operating for in loop we can access the index of each position of the array.
Now let’s try with the For Of.
Now we got access to the actual value of each position.
In conclusion, the For In can be used to access the index of each array element, and the For Of is used to access the values of each position.
Now, let's complicate it a little bit.
We changed our array into a object, in order to see what kind of effects and things we can do using these loops.
On the For in perspective, we still can access the index of each element.
Now let's see what we can do for For of.
We will use the Object.entries to convert the object into an array.
So now we can access both index and value.
Thanks for the reading and keep tuned for the next article.
What you get is faster time to market, improved security, unlimited scalability and better customer experience. We can help kickstart and support your cloud native adoption. Contact us through the options below:
Hiring and retaining top tech talent is a very hard task today. All on top of running your business. No matter the technology, we have the perfect setup for attracting the best experts and help you grow.
Building an online presence with complex journeys than span across devices is a really hard task but a must have to win in today's digital world. Our experience in web app development, will help overcome that.
With users used to the have the best mobile apps running on their phones, building a delightful app that users love is not as simple as it might seem. There's where our mobile team shine!
While AI's presence in software has grown significantly, companies are still grappling with the initial steps and strategies to effectively use AI within their daily operations. Our offer is focused on assisting you in overcoming this challenge.