Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# array
for color in ["red", "blue", "pink"]
console.log color
# 1行で書くとこんな感じ
console.log color for color in ["red", "blue", "pink"]
# whenで条件指定
console.log color for color in ["red", "blue",
"pink"] when color isnt "blue"
# "red" "pink"
# indexを取る
console.log "#{i} : #{color}" for color , i in ["red", "blue", "pink"]
###
0 : red
1 : blue
2 : pink
###
# object
result =
chuck : 50
man : 20
Hello : 40
for name, score of result
console.log "#{name} : #{score}"
###
chuck : 50
man : 20
Hello : 40
###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment