Home >Web Front-end >JS Tutorial >forEach traversal loop

forEach traversal loop

巴扎黑
巴扎黑Original
2016-11-25 15:08:411301browse

[color=darkred][/color]
Javascript array loop traversal forEach
1. js array loop traverse.
Array loop variables, the first thing that comes to mind is for(var i=0;iIn addition, you can also use the simpler forEach method; 2. forEach function.
The Array type of Firefox and Chrome both have forEach function. In IE, Array does not have a forEach method. 3. Break out of the loop: Js ForEach in this situation cannot use continue, break; You can use the following two methods: 1. if statement control 2. return. (return true, false) return --> similar to continue...


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:js array sortingNext article:js array sorting