JavaScript字符串转浮点型(JavaScript string to floating point)

js提供了parseInt()和parseFloat()两个转换函数。前者把值转换成整数,后者把值转换成浮点数。

参考:https://blog.csdn.net/ufo2910628/article/details/40735691(js 字符串转换成数字的三种方法)

>>OpenLayers的一个bug:如果传入Polyline的点集合为字符串类型的数字,则显示为起点和终点之间的连线。必须对数组中的每个值ParseFloat,不知道为什么

————————

JS provides two conversion functions: parseint() and parsefloat(). The former converts the value to an integer, and the latter converts the value to a floating point number.

reference resources: https://blog.csdn.net/ufo2910628/article/details/40735691 (three methods of converting JS strings into numbers)

>& gt; A bug in openlayers: if the point set passed into polyline is a number of string type, it will be displayed as a connecting line between the starting point and the ending point. You must parse float for each value in the array. I don’t know why