当前位置:网站首页>Interrupt array Foreach method [js implementation]
Interrupt array Foreach method [js implementation]
2022-06-23 03:00:00 【It workers】
Realization principle
There is no built-in method to implement interrupts forEach, If we want to implement interrupts forEach, We can do this by throwing an exception .
Implementation code
var BreakException = {};
try {
[1, 2, 3].forEach(function(el) {
console.log(el);
if (el === 2) throw BreakException;
});
} catch (e) {
if (e !== BreakException) throw e;
}边栏推荐
- January 31, 2022: Maze III. There is a ball in the maze of open spaces and walls. ball
- Gorilla/mux framework (RK boot): add swagger UI
- How to use pictures in Excel in PPT template
- The commercial s2b2b e-commerce platform of aquatic industry improves the competitiveness of enterprises and creates a strong engine for industrial development
- method
- An article shows you the difference between high fidelity and low fidelity prototypes
- "Return index" of live broadcast E-commerce
- A bit about the state machine (FSM SMR DFSM)
- Summary of easy-to-use MySQL interview questions (Part 1)
- Scanning technology (getting started with web security 06)
猜你喜欢

How to store, manage and view family photos in an orderly manner?

6. template for integer and real number dichotomy

Soft exam information system project manager_ Information system comprehensive testing and management - Senior Information System Project Manager of soft test 027

Vulnhub DC-5

Spark broadcast variables and accumulators (cases attached)
What is sitelock? What is the function?

C language series - Section 4 - arrays

Soft exam information system project manager_ Contract Law_ Copyright_ Implementation Regulations - Senior Information System Project Manager of soft exam 030

8. greed

5. concept of ruler method
随机推荐
Docker builds MySQL master-slave
How PHP uses redis
How to batch make decreasing serial number barcode
Capture passwords of all chrome versions
How to customize a finished label template
Pyqt5 installation and use
What if the software gets stuck and cannot end the process?
Tencent cloud server CVM system tool configuration
Detailed explanation of online reputation management
February 3, 2022: a group of people (two or more) want to meet at the same place
The priority supplier field in the purchase information record of SAP mm primary level
Troubleshooting and optimization of easynvr version 5.0 Video Square snapshot not displayed
No error is reported when using the Gorm framework to create a table, but the data cannot be inserted successfully
How to prohibit copying and copying files to the local server remote desktop
How to gracefully solve the problem of platform font adaptation
Use micro build to realize search function
Learning records - things inherited by subclass parent of C #
Construction and exploration of vivo database and storage platform
A penetration of an internal self built shooting range
Markdown - enter a score (typora, latex)