roger
roger

Reputation: 1263

nodejs cli return [Function: values] for [].values

I came across this today, and just want to get more on why and how [].values is a function

$ node -e 'console.log([].values)'
[Function: values]

Upvotes: 0

Views: 89

Answers (1)

Bergi
Bergi

Reputation: 664589

Array.prototype.values is a function that your empty array inherits. It's usually called as a method and returns an iterator.

Upvotes: 2

Related Questions