r/shittyprogramming • • Apr 12 '16

Easy JavaScript game loop

Post image
277 Upvotes

37 comments sorted by

View all comments

Show parent comments

3

u/Niriel Apr 12 '16

Does JavaScript have a Bottom type? That's the only return type that makes sense for an infinite loop, since it's uninhabited.

4

u/Darksonn Apr 12 '16

No, but they don't have return types either, so it's fine.

4

u/Niriel Apr 12 '16

They don't have a return value, but they do have a return type. Bottom is a type with no value. https://en.m.wikipedia.org/wiki/Bottom_type

1

u/Darksonn Apr 13 '16

You misunderstand. I know perfectly well what a bottom type is, and I wasn't referring to functions that never return.

I was referring to functions in javascript. In javascript no function has a return type; if they return, they just return a thing. That's why there's no need for a bottom type in javascript.