简体   繁体   English

带十进制 React Native 的加法不返回数字

[英]Addition with decimal React Native doesnt return number

I am in a project building simple mathematic app with react native.我正在一个项目中构建带有本机反应的简单数学应用程序。 but when my input is added with decimal number, it doesnt sum, but it just merge但是当我的输入加上十进制数时,它不求和,但它只是合并

var height = 56
const convertHeight = height+0.7

it return 560.7, instead of 56.7它返回 560.7,而不是 56.7

Try this:尝试这个:

var height = 56
const convertHeight = height*1.0+0.7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM