function work_waypoints(waypt2){
waypts.push({
location: waypt2[i][g].latlgn,
stopover: true // obrigatório paragem
});
return waypts;
}
答案 0 :(得分:0)
我不确定您要在这里做什么。据我了解,也许您可以对数组内容尝试以下方法:
Array.from(
{ length: 21 },
(_, index) => ({
stopover: true,
location: object[index] // ...
})
)
答案 1 :(得分:0)
以下代码生成以随机整数为位置的航点,
function generateWaypoints(){
console.log(Array.from({length: 3}, () => Math.floor(Math.random() * 150)));
}
Function.prototype.sequence = function(from, to) {
for (var i = from; i <= to; i++) this.call(null, i);
};
generateWaypoints.sequence(0, 21);