如何將包含科學計數法的字串轉換為正確的 JavaScript 數字格式?
要轉換帶有科學計數法的字串,請使用 Number 函式。將值傳遞給此函式。
示例
你可以嘗試執行以下程式碼,將字串轉換為正確的數字格式 −
<!DOCTYPE html>
<html>
<body>
<script>
document.write("String with Scientific Notation converted below:<br>");
document.write(Number("7.53245683E7"));
</script>
</body>
</html>輸出
String with Scientific Notation converted below: 75324568.3
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP