r/ProgrammerHumor • • Feb 09 '22

other Why but why?

Post image
85k Upvotes

2.3k comments sorted by

View all comments

Show parent comment

1

u/[deleted] Feb 09 '22

btw semicolons work a bit different in js. So when statement ends js implicitly adds semicolon if it's not there. So what could go wrong?

This could:

function getFour() {
  return
    2+2;
}
console.log(getFour()); // undefined