Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I thought my solution is the ugliest...
Good answer, but the formatting needs some work. The variable names should be descriptive, and the return value should get its own line.
this is needed to return the accumulator result after each iteration
Amazing! 👏🏻👏🏻👏🏻
Looks like in addition to 'Best Practice' and 'Clever' solutions I strongly would like to have the button 'OMG' or 'LOL' :). Anyway, appreciate the persistance of the author!
calc('9+1')
return emtpy stringso, You should write
if(peek() > '0' && peek() <= '9')
.LOL...
Thank you, you are right.
Your code is not benchmarking anything significant; you perform the same control operation way too many times, and then only perform the thing to test (Array.from vs [...array]) only once. Naturally the result doesn't indicate anything.
Why are you using
document.querySelectorAll('a')
? Can't you just, you know, use typical arrays? Like:Which would show that
Array.from
is at least twice as slow.Hello, after listening to your advice,
I have made some tests as follows, but I have not found that
Array.from
is slower than[...Arr]
.My Configuration
Google chrome
Version 65.0.3325.181 ( official version ) ( 64 bits )
I guess it must have something to do with V8.
Array.from
is slow, very slow, so no.The best practice is
[...]
array.from also didn't exist 2 years ago lol