In general, a line-break
let array = [ 'erik', 'jeff', 'elon' ] let l = array. length
let age = 34 ++ age // 35 // It's weird to find code written like this
while(true) console.log('Hello, world') if(true) console.log('Bye, world')
const hello = () => ['erik', 'jeff', 'elon'] hello() [1, 2].forEach(e => console.log(e)) // Uncaught TypeError: hello(...)[(1 , 2)].forEach is not a function // Here, a semicolon is required
You can solve this case by writing a semicolon (or a comma) at the end of the function, or a the beginning of the new line:
const hello = () => console.log('test') hello(), [1, 2].forEach(e => console.log(e))
Sites like GitHub are free from semicolons. From now on, I'll avoid them as well.
Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.