java-script:for-in-vs-for-of
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
java-script:for-in-vs-for-of [2023/08/10 03:02] – odefta | java-script:for-in-vs-for-of [2023/08/11 12:22] (current) – odefta | ||
---|---|---|---|
Line 75: | Line 75: | ||
However, you can convert an object' | However, you can convert an object' | ||
Example: | Example: | ||
- | < | + | < |
const person = { | const person = { | ||
name: ' | name: ' | ||
Line 111: | Line 111: | ||
In this example, **Object.keys(person)**, | In this example, **Object.keys(person)**, | ||
- | ====== Conclusion | + | ===== Conclusion ===== |
* Use **for...in** to iterate over the **keys** of an **object** (including non-array objects). | * Use **for...in** to iterate over the **keys** of an **object** (including non-array objects). |
java-script/for-in-vs-for-of.1691625735.txt.gz · Last modified: 2023/08/10 03:02 by odefta