for…of is a new thing which is super powerful but still not known a lot and in this tutorial, we are gonna have a look at it

Constantly evolving and upgrading features of a language is a good sign and as we all know that Javascript is super powerfull and provide us multiple ways to achieve a single task which all follow differently approaches whichever suits you use that

Simple Concept and in this tutorial we are gonna look for…of a new way to loop through objects or the latest competitor for our old for loop

Now without wasting any time let’s just learn about it and have a look at its concepts

for…of and its syntax

for…of is a new way to loop through iterable objects means we can loop through arrays, objects, strings, everything that we can do with for loop pretty simple right

Now let’s look at the syntax

for(let variable_name of arrayName){
	//body of the execution

That’s all for the syntax Now Let’s Look at a few examples to understand things a bit better

A Few Examples

Let’s start to give you a ride of how to implement it on practical grounds by these well-explained ones

for…of and arrays

Let’s start first with an array

let colors = ["red","blue","green","orange","black","white"];

for(color of colors){


Now as you can see everything is on the console

Let’s have a look at one more

let animals = ["Dog","Cat","Goat","Lion","Tiger","Peacock"]

for(cuteOne of animals){
	console.log(`${cuteOne} is cute`)

If you are confused about the console.log statement actually i used template literals if you don’t know about them I recommend checking out this

Maybe you got a decent overview of this

As you all get up the rough of how to play with for…of on arrays but let me tell you did you know that strings are also be looped yeah they are as same as an array

Strings and for…of

As we all know there is not so much relational difference between an array or a string Let’s have a look at how to do the same

let string = 'I love this tutorial';

for (let char of string) {


//Every letter will be single letter // 

Wrapping UP

I hope after reading this tutorial you got to learn about the new things for…of and if you know about it then still maybe you got a better understanding of it if you liked this tutorial you can have a look at my other one as well also if you want to learn more about it i recommend MDN DOCS and you always know every question or criticism and appreciations all are welcomed