是否有可能将每个字符包装在 Javascript 中并在其小于 X 位时添加零?
我得到/拥有的:
var votes = 2;
//or
var votes = 123;
//or
var votes = 4321;
它应该是什么样子:
<span>0</span><span>0</span><span>0</span><span>2</span>
//or
<span>0</span><span>1</span><span>2</span><span>3</span>
//or
<span>4</span><span>3</span><span>2</span><span>1</span>
所以结果应该是一个四位数的数字。