본문 바로가기

개발관련/front-end

[javascript js] for ...of / for ...in

728x90

The for ...in statement iterates over the enumerable properties of an object.

(enumerable : able to be counted by one-to-one correspondence with the set of all positive integers.)

 

The for ...of statement iterates over values that the iterable object defines to be iterated over.

 

 

 

 

 

 

 

 

 

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of

 

for...of - JavaScript | MDN

The for...of statement creates a loop iterating over iterable objects, including: built-in String, Array, array-like objects (e.g., arguments or NodeList), TypedArray, Map, Set, and user-defined iterables. It invokes a custom iteration hook with statements

developer.mozilla.org