zr-14q
Last Updated: February 25, 2016
·
2.161K
· ipetepete
522f44265e0ed80578f6d3af4cdf7011

Iterate over object properties

If you need to iterate through an object using Coffeescript, us the of keyword in the loop, ex:

obj = {
     stuff: "my stuff"
     funk: ()->
         alert "My funky function"
     more: "more stuff"
}

for x of obj
   if typeof(y) is "function"
       alert "#{x} is a function!"
   else
       alert "#{x} is a property"
Say Thanks
Respond