neoeahit
neoeahit

Reputation: 1799

how to get all values of object via coffeescript?

I have an object say:

var temp = {d:4,f:4,g:5};

is there any way to get all values out of it using coffeescript?

Upvotes: 2

Views: 2143

Answers (2)

Ch.Idea
Ch.Idea

Reputation: 588

Well, in case of having an object filled with class instances, icktoofay's answer would be great, but if not, let's keep it clear that it's possible to do it without the own keyword.

temp = {d:4,f:4,g:5}
console.log val for key, val of temp
# result is '4,4,5'

Upvotes: 2

icktoofay
icktoofay

Reputation: 129059

Absolutely.

values = (value for own prop, value of temp)

Upvotes: 3

Related Questions