• ###### Chrono79commented on "Nth Smallest Element (Array Series #4) " javascript solution

No, it isn't.

• ###### MaurizioAlfarocommented on "Nth Smallest Element (Array Series #4) " javascript solution

So then... Is it really a best practice?

• ###### Chrono79commented on "Nth Smallest Element (Array Series #4) " javascript solution

Yes, it does.

• ###### MaurizioAlfarocommented on "Nth Smallest Element (Array Series #4) " javascript solution

Doesn't this modify the Input?

• ###### stabnitecommented on "Waiting room" javascript solution

Is there a formal proof why this is the case?

• ###### dmitrokozcommented on "Filtering even numbers (Bug Fixes)" java solution

when u use listOfNumbers.remove(i); it removes and replace with next indexed number. So u need to check it again but u dont.
When u check it from end to start u needn't to check again cause of all from the end always checked.

Lists work not as arrays and have not fixed length.

• ###### gooddhacommented on "Sum of array singles" javascript solution

Looks clean, great approach! But indexOf + lasIndefOx calls count make perfomance side not so good.

• ###### saar4kcommented on "Regex Ninja: Unique Digits" javascript solution

This comment is hidden because it contains spoiler information about the solution

• ###### JohanWiltinkcommented on "Filling an array (part 1)" javascript solution

Memory shouldn't make a difference.

`a = Array(1e7); for ( let i=0; i<1e7; i++ ) a[i] = i;` takes ~`50` ms on my machine.

`Array.from(..)` takes ( wait for it - literally :P ) ~`3300` ms.

For `1e3` elements, it's ~`.2` ms vs. ~`1` ms.

• ###### benslvcommented on "Filling an array (part 1)" javascript solution

How is this performance-/memory-wise compared to populating it via a `for` loop?

• ###### JohanWiltinkcommented on "Filling an array (part 1)" javascript solution

The object doesn't even contain undefined items. It only has `length`. There's a difference between existing properties that happen to be `undefined` and actual missing, or empty, ones. Cf. `[undefined,0]` vs. `[,0]` ( yes, that's valid JS ). But if you ask for a non-existent property, JS will not throw a `ReferenceError`, but give you `undefined` instead, unlike when you ask for a non-existent variable.

• ###### librarianbencommented on "Filling an array (part 1)" javascript solution

Someone tell me if I'm wrong please: the object the array is being mapped from contains N undefined objects, so the indexes of N undefined objects are mapped to the array.

• ###### MarselBurdocommented on "Filling an array (part 1)" javascript solution

JohaWiltink, thx.