string - integer length in javascript -
stoopid question time!
i know in javascript have convert integer string:
var num = 1024; len = num.tostring().length; console.log(len);
my question this: why there no length property integers in javascript? isn't used often?
well, don't think providing length properties number helpful. point length of strings not change changing representation.
for example can have string similar this:
var b = "sometext";
and length property not change unless change string itself.
but not case numbers.
the same number can have these 2 representations:
var = 23e-1; , var b = 2.3;
so these 2 representation clear same number can have multiple representation , so, if have length property numbers have change representation of numb.er
Comments
Post a Comment