JS For…In StatementPritesh
For…In Statement : Loop Through the properties of an object
- The for…in statement loops through the properties of an object.
- The code in the body of the for…in loop is executed once for each property.
Live Example : For..In Statement
Java Programming Pritesh Taral 275
- We have declared object book having 3 properties.
- Properties are – bname,author and pages.
- x is declared as index variable which is used while iterating through object properties.
- For..In Loop will print values of all properties in a sequence in which they are declared.