simplified for

PHOTO EMBED

Fri Mar 05 2021 19:57:30 GMT+0000 (Coordinated Universal Time)

Saved by @w_jellett #javascript

Not every case you can replace a looping method for the short one, but if it does then do it.
Instead of:
let names = [‘Amy’, ‘James, ‘David’, ‘John’];
for (let i = 0; i < names.length; i++) {}
Do this:
let names = [‘Amy’, ‘James, ‘David’, ‘John’];
for (let name of names) {}
In case the indexes matter:
for (let [index, name] of names.entries()) {}
content_copyCOPY

https://javascript.plainenglish.io/15-simple-coding-techniques-to-get-your-tasks-done-with-shorter-code-in-javascript-59d46801db0