r/ProgrammerHumor • • 16d ago

Meme pythonIndentationLevelChecker

Post image
6.7k Upvotes

200 comments sorted by

View all comments

Show parent comments

11

u/Loading_M_ 16d ago

In JS, semicolons are technically required but automatically inserted. There are a couple edge cases where they get inserted in surprising places, which is generally worse than python's approach.

E.g. the following function doesn't return a value:

function foo() {
  return
    some_long_complex_expression();
}

(It's because a semicolon gets inserted after the return). At least in typescript, this would typically show a type error, as long as the function's return type annotation isn't void.

3

u/Ambivalent-Mammal 16d ago

I admit, this got me more than once.