Lodash - toFinite 方法

语法

_.toFinite(value)

将 value 转换为有限数字。

参数

  • value (*) − 要转换的值。

输出

  • (number) − 返回转换后的数字。

示例

var _ = require('lodash');

console.log(_.toFinite('3.2'));
console.log(_.toFinite(Infinity));

将上述程序保存在tester.js中。运行以下命令执行该程序。

命令

\>node tester.js

输出

3.2
1.7976931348623157e+308

lodash_lang.html