当前位置:网站首页>[circular array] JS method collection of circular array
[circular array] JS method collection of circular array
2022-07-25 02:22:00 【Ma Xiaotiao's coding advanced road】
One 、forEach loop
notes : No, return Return value , And can't use break Out of the loop .
let arrlist = ['123','456','789'];
arrlist.forEach(function (value, index) {
//value It's every item ,index It's the index
console.log(value,index);
});
Two 、for loop
notes : This is the most basic way of circulation , You can use return End .
for(var i = 0;i < 10; i++){
console.log(i) // in every particular
}
3、 ... and 、map loop
notes : Map the original array into a new array , The original array will not be manipulated , Return a new array . Support return return .
let arrlist = ['111','222','333'];
arrlist.map(function(value,index){
//value in every particular ,index Indexes
console.log(value,index);
});
Four 、for of loop
notes : yes ES6 New loop method . You can respond to break、continue and return End . Support array , Class array objects are also supported .
let arrlist = ['111','222','333'];
for(let item of arrlist){
console.log(item); //item Refers to each item of the array .
}
// Output '111' '222' '333'
Ongoing update ~
边栏推荐
- These 11 chrome artifacts are extremely cool to use
- I was forced to graduate by a big factory and recited the eight part essay in a two-month window. Fortunately, I went ashore, otherwise I wouldn't be able to repay the mortgage
- G024-db-gs-ins-01 openeuler deployment opengauss (single instance)
- Introduction to ORM framework - what is ORM framework?
- DNA helped solve the outstanding case 30 years ago. The suspect strangled his girlfriend because he fell in love with his roommate. He was already the CEO of the technology company when he was arreste
- Detailed explanation of manually writing servlet in idea
- Dynamic memory development
- [recognize cloud Nativity] Chapter 4 cloud network section 4.9.4.3 - smart network card usage scenario - network acceleration implementation
- [hero planet July training leetcode problem solving daily] 20th BST
- Talk about what's going on with C # backstage GC?
猜你喜欢

Use SAP ui5 application to consume create and delete operations of OData in business application studio

6-10 vulnerability exploitation SMTP experimental environment construction
It's still a synchronization problem

My creation anniversary (3rd Anniversary)

Remote sensing image classification tool and visualization application of WebGIS

Jsonp solves cross domain plug-ins (JS, TS)

Is it necessary to increase the number of milliseconds and save several KB of memory in the program?

Actf questions (dropper+master_of_dns)

How to judge which star you look like?

A bit of knowledge - websites about scripts
随机推荐
Case analysis of building exhibition service management system with low code development platform
PostgreSQL views tables, table indexes, views, table structures, and parameter settings
Deamnet|filenotfounderror: [winerror 3] the system cannot find the specified path.: '/ Datasettest\\Set12‘
Ecosystem long-term observation data product system
[leetcode] 2. Add two numbers - go language problem solving
Completefuture parallel asynchronous return processing
Freedom and self action Hegel
On the economic model of open source ecology
VRRP virtual redundancy protocol configuration
A bit of knowledge - websites about scripts
Speed comparison between 64 bit width and 32 bit width of arm64 memory
Server performance monitoring
Promise basic use
What do growth enterprises need most to build a data-driven organization?
Apk packaging process
Detailed explanation of the principles and differences between static pages and dynamic pages
Standard transfer function
Remote sensing image classification tool and visualization application of WebGIS
Keepalivetime=0 description of ThreadPoolExecutor
Solution to the occupation of project startup port