forEach for in for of

forEach
executes the provided function once for each element of the array (return, break, etc. cannot be used to interrupt the loop) without changing the original array, and no return value undefined. The values ​​traversed by the
for...in
loop are the key values ​​of the data structure (you can traverse the array but it is more suitable to traverse the object)
for...of
is a newly added syntax in ES6, which is used to cyclically obtain the values ​​in a pair of key-value pairs

Guess you like

Origin blog.csdn.net/weixin_46300135/article/details/113267956