2017-03-16 72 views
-2

var collectionsd返回類似收集變量中的所有值的JavaScript控制檯日誌

[5.2140564, 52.3705452] 
[5.2180339, 52.3363171] 
[5.2424313, 52.3595914] 
[5.2739435, 52.388464] 
[5.2368864, 52.336711] 

在前端只顯示[5.2368864, 52.336711]我需要下面喜歡在JavaScript中。

var collectionsd = [[5.2140564, 52.3705452],[5.2180339, 52.3363171],[5.2424313, 52.3595914],[5.2739435, 52.388464],[5.2368864, 52.336711]]; 

更新:-1

this.variables = JSON.parse(jso); 
    this.passing=[]; 
    zc.passing.push(zc.variables['geo']); 
    console.log(zc.passing); 
ouptut:- 
[5.2140564, 52.3705452] 
[5.2180339, 52.3363171] 
[5.2424313, 52.3595914] 
[5.2739435, 52.388464] 
[5.2368864, 52.336711] 

我需要做的ZC。在單個數組中傳遞值。

+0

什麼是你的代碼看起來像那麼遠? –

+0

var collectionsd = zc.variables ['geo']; – JohnS

+0

它返回新的對象。需要返回與數組相同的對象 – JohnS

回答

0

是的,這是可能的。你可以這樣做。

var fruits = [[5.2140564, 52.3705452],[5.2180339, 52.3363171]];  


    fruits.push([5.2424313, 52.3595914] , [5.2739435, 52.388464] ,[5.2368864, 52.336711]); 
    console.log(fruits); 

+0

var水果不像你說的。它就像 var fruits = [5.2140564,52.3705452] [5.2180339,52.3363171] – JohnS

+0

你想要一個像[5.2140564,52.3705452]所有其他數組的數組?或者你需要5個不同的陣列? – Kaleem

+0

@JohnS'var fruits = [5.2140564,52.3705452] [5.2180339,52.3363171]'不正確!這是一個數組或多個變量 – Weedoze

相關問題