Reputation: 14296
var names = [name for(name in generateNames(product))];
generateNames
just returns an array of column names for various properties in a product.
But what is the whole name for name in thing?
Upvotes: 1
Views: 184
Reputation: 262939
That's an array comprehension.
It's a new feature of Javascript 1.7, and works like Python's list comprehensions.
Upvotes: 7
Reputation: 88378
It is an array comprehension. It was added to JavaScript 1.7. Works only in Mozilla browsers like Firefox AFAIK.
Here is a jsfiddle you can try, in Firefox only: http://jsfiddle.net/hfARW/1/
Upvotes: 4