DEV Community

Discussion on: 10 Awesome JavaScript Shorthands

Collapse
 
efpage profile image
Eckehard

Generally for .. of works fine, but was not supported on some older browsers on Android. So, referring to my personal experience, in a real application it can help to use for .. in to get better compatibility.

let fruits = ['🍉', '🍊', '🍇', '🍎'];

// Using for...of statement 
for (let i in fruits) {
  console.log( fruits[i]);
}
Enter fullscreen mode Exit fullscreen mode