简体   繁体   English

这个JavaScript构造是什么:“= [每个y ...]”

[英]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... 我理解这是做什么的,返回所有不是当前的'y'项...

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 . 显然这是在Javascript 1.7中引入的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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