// Iterates for all properties through chain
for (const i in data) {
if (data.hasOwnProperty(data[i])) {
const item = data[i];
}
}
// ES6
for (const i of data) {
const item = i;
}
// Little trick with destructing. Instead of:
for (const periods of PERIODS_SET) {
const [from, to] = periods;
}
// We can do:
for (const [from, to] of PERIODS_SET) {
...
}