我正在尝试遍历地图。但是它用科学计数法转换了我的十进制数。
let obj = {
1: 'one',
2: 'two',
3: 'three',
7: 'seven'
};
// make sure that your case is in order
// get keys of your object
const keys = Object.keys(obj);
// find index of starting key
const index = keys.indexOf('3');
// make sure index >= 0
// each all keys from starting key to the end by old school way
for (let i = index; i < keys.length; i++) {
var key = keys[i];
console.log(obj[key]);
}
如何将其转换为带位置的常规小数 请帮忙。