Last Updated: February 25, 2016
·
2.476K
· ipetepete

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"