前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >javascript当中parseFloat用法

javascript当中parseFloat用法

作者头像
马克java社区
修改2019-11-26 10:12:03
5980
修改2019-11-26 10:12:03
举报
文章被收录于专栏:java大数据java大数据

3)parseFloat 例 4.3.1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <BODY> <SCRIPT LANGUAGE="JavaScript"> <!-- /* 马克-to-win parseFloat() (Function/global) Parse a string to extract a floating-point value. Property/method value type: Number primitive JavaScript syntax: - parseFloat(aNumericString) Argument list: aNumericString A meaningful numeric value. The parseFloat() function returns a numeric value is returned, unless the string cannot be resolved to a meaningful value in which case NaN is returned instead. It produces a number value dictated by interpreting the contents of the string as if it were a decimal literal value. During conversion parseFloat() ignores leading whitespace characters so you don't have to remove them from the string before conversion takes place. Note that parseFloat() will only process the leading portion of the string. As soon as it encounters an invalid floating-point numeric character it will assume the scanning is complete. It will then silently ignore any remaining characters in the input argument. */ var x = parseFloat("727.079") var y = parseFloat("77.079xyz") var z= parseFloat("xyz77.079") document.write("x="+x+",y="+y+",z="+z) //--> </SCRIPT> </BODY> </HTML>

更多请见:https://blog.csdn.net/qq_43650923/article/details/102231498

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档