Iterate over an array of numbers and print each value
array = [1,2,3,4]
for number in array:
print(number)array = [1,2,3,4]
array.each do |number|
puts number
endvar array = [1,2,3,4];
array.forEach(function(number) {
console.log(number)
});It's a little confusing that you did the same thing twice in the Python one.
@Mr0grog: realized I left the 2nd one in :P
@calvinmetcalf: updated! I'm mostly a plumber in JS, so that's why it's great to have other people take a look.
Got JavaScript
array.forEachis the better syntax, this one won't work well