Mine is shorter ;D
best solution! zero in the end is very readable!) but "a" as solo condition I would change to most readable "a != null"
...(x = y)... is a hack to compute smth in 1 line (and no to use new variable)
So the w in comparisons to the right contains the result.
And w/(h^2) is the BMI from the task.
You could probably remove one of those arguments in the map lambda. Other than that--pretty keen
Interesting solution. I don't quite understand what the assignment operator is doing in (w = w / h / h). Do you mind explaining?
(w = w / h / h)
Shouldn't store a functional expression in a mutable variable (let). Use const instead as a general rule.
I know slice is better.
It's a bad soultion when you are concerned about performance
That's beautiful, I havent been programming in a functional manner in a while, I am going to have to re-learn "Functional Style Programming" anyway I used 3 built in functions on mine, I like to keep things simple :D
Because of some unknown reason I guess?
It doesn't matter though, because the expression s += e return the result of the operation, so you end up with the same value every aggregate. Primitive values are pass as, well, value, so the side effect on s is not noticable.
s += e
hello. why are you 's += e' instead of 's + e'?
You should always make sure to declare your variables (stringToArray) with var, let, or const, otherwise it will be attached to the parent scope.
Watch out for floating point errors on loop iterations on this one. It's pretty subtle.