Sitemap

[JavaScript] Number.parseFloat vs parseFloat

Jun 6, 2021

--

Canva

本篇文章屬個人見解,若有錯誤部分,請不吝指教

版本:ECMAScript 2015/ES6

說明

簡單來說,Number.parseFloat()跟parseFloat()就是一樣的功能,而為什麼在ES2015之後,會出現一樣的Function呢,這是為了模組化。所以未來也許parseFloat會被移除也說不定呢。

Get Leisure Rife’s stories in your inbox

Join Medium for free to get updates from this writer.

MDN裡Number.parseFloat的說明

This method has the same functionality as the global parseFloat() function:Number.parseFloat === parseFloat; // trueThis method is also part of ECMAScript 2015. (Its purpose is modularization of globals.)

關聯資料

--

--

Leisure Rife
Leisure Rife

Written by Leisure Rife

Searching for a life that suits me best in this busy world—perhaps constantly moving from city to city is just my way of living.