How to differentiate between JS "For....in" and "For...of"? #208
-
From my experiments, I seem to be able to only generate a JS "For...in" from a Ruby "For...in". Is there a way to get a "For...of" generated? |
Beta Was this translation helpful? Give feedback.
Answered by
jaredcwhite
Apr 24, 2024
Replies: 1 comment 1 reply
-
@esb The arr = [1,2,3,4]
arr.each do |item|
puts item
end turns into let arr = [1, 2, 3, 4];
for (let item of arr) {
console.log(item)
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
esb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@esb The
functions
filter, which is in the default preset, automatically converts Ruby'seach
tofor...of
:turns into