functionsquare(n){with(Math){for(leti=Number.MAX_SAFE_INTEGER;i>=0;i--){constisSquared=sqrt(i)===nif(isSquared)returni}}thrownewError('Number too big to be squared!')}
note: using with should improve performances since it does not need to access Math each time sqrt is used
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
note: using
with
should improve performances since it does not need to accessMath
each timesqrt
is used