|
|
|
|
|
by lomnakkus
2883 days ago
|
|
The JS way is a mistake, intentional or not. Here's a little thought experiment: Your program ends up with an "undefined" in some variable 'x'. How did that happen? In JS it can happen in any number of weird and wonderful ways, e.g. you called a function which did a 'v[i]' or it could have just fallen off the end because someone forgot to check a return path, or... In Python there's much less scope what the problem could be. Since v[i] will just throw an IndexError, you know that the problem couldn't possibly be stray index or similar. That is a much better experience for finding problems in one's code. |
|