1. Call the toString method to convert it into a string and get the length.
1
2
defined variable
figure
=
123;
alert(num.toString()。 Length);
2. Take the length after implicitly converting the string.
1
2
defined variable
figure
=
123;
Alarm ((No.
+
'). Length)
The method of 1 is recommended, which is simple and efficient.