oren @oren

Advice to all Python users: learn JavaScript

Jul 6, 2022, 10:01 PM
51
View all

comments

Highlighted comment

i already did, it’s cool but i want 1/0 to actually raise an error

too bad, js only has a catch-all Number type, so Infinity is the right response for 1/0

JS has Error types, it can throw them. In fact, they can throw them inside the / operator itself. Watch.

x = {valueOf:1}
1/x