简体   繁体   English

如何缩短返回的坐标?

[英]How do I shorten returned coordinates?

Using Cycript (mixed with javascript) via a tweak I have this code:通过调整使用 Cycript(与 javascript 混合)我有这个代码:

var latitude = [IS2Weather currentLatitude];

This returns -1.65456038607131e+25这将返回 -1.65456038607131e+25

I want to limit it to 6 decimal places (-1.654560), what is the correct way to achieve this please?我想将其限制为 6 位小数(-1.654560),请问实现此目的的正确方法是什么? I can't seem to get anything to work.我似乎什么都做不了。

您是否尝试过调用latitude.toPrecision(6)

使用 javascript .toFixed(n)方法

latitude = latitude.toFixed(6);

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

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