Comment

Comment by lshevtsov

It's because it is not proven that element with the index 1 exists. Even TypeScript enforces bounds checking these days.

As for the first one - as i understand, this will spoil the original array, as it is assigned by reference; so by writing the string into `numbersOrStrings`, you also write it into `numbers`, thus violating the type.

parent lshevtsov 4 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton