简体   繁体   中英

What is this JavaScript construct: “ = [y for each …]”

myColl.y = [y for each (y in myColl.y) if (y != myThing.getY())];

I understand what this is doing, returning all the 'y' items that are not the current one...

But, what is the concept called here with the brackets? I would like to read up on what this is , syntax, etc.

It's an array comprehension.

Apparently this was introduced in Javascript 1.7 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM