Home >Web Front-end >JS Tutorial >JavaScript For...In usage_Basic knowledge
The For...In statement is used to traverse the properties of an array or object (loop through the properties of an array or object).
JavaScript For...In Statement
For...In Statement is used to loop through the properties of an array or object.
For ... every time the code in the loop is executed, an operation will be performed on the elements of the array or the properties of the object.
Syntax:
for (variable in object)
{
Execute code here
}variable is used to specify variables. The specified variables can be array elements or attributes of the object.
Example:
Use for ... in loop to traverse the array.