Longueur javascript du nombre
x.toString().length // x is a number
Clumsy Cicada
x.toString().length // x is a number
var num = 1024,
str = num.toString(),
len = str.length;
console.log(len);
var colors = ["Red", "Orange", "Blue", "Green"];
var colorsLength=colors.length;//4 is colors array length
var str = "bug";
var strLength=str.length;//3 is the number of characters in bug
var num = 1234
number.toString().length; // 4
export function numberLength(number) {
let length = 0;
let n = Math.abs(number);
do {
n /= 10;
length++;
} while (n >= 1);
return length;
}
export default numberLength;