在下面的代码段中,如何显示消息
Min value is 0.00000001.
而不是
Min value is 1e-8
var minValue = 0.00000001;
var message = "Min value is " + minValue.toString();
var content = $('p#content').text(message);

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p id="content"></p>
&#13;
答案 0 :(得分:2)
使用Number#toFixed
或使用字符串而不是数字。
var minValue = 0.00000001;
var message = "Min value is " + minValue.toFixed(8);
var content = $('p#content').text(message);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p id="content"></p>
答案 1 :(得分:0)
var minValue = "0.00000001";
var message = "Min value is " + minValue;
var content = $('p#content').text(message);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p id="content"></p>