1var colors = ["Red", "Orange", "Blue", "Green"];
2var colorsLength=colors.length;//4 is colors array length
3
4var str = "bug";
5var strLength=str.length;//3 is the number of characters in bug
1var num = 1024,
2str = num.toString(),
3len = str.length;
4
5console.log(len);
6
1export function numberLength(number) {
2 let length = 0;
3 let n = Math.abs(number);
4 do {
5 n /= 10;
6 length++;
7 } while (n >= 1);
8 return length;
9}
10
11export default numberLength;