Statements

for...in statement

Try the free JavaScript compiler

Enumerates enumerable string property names, including eligible inherited names, not property values or symbols. Do not use it as a general array value loop.

Formal Syntax & Structure

javascript syntaxjavascript
for (const key in object) { … }

Working Example

Example Snippetjavascript
const o={a:2,b:4};for(const k in o)console.log(k);
JavaScript Reference