我有這種形式的數據[1,2,3,4]
。我想對這個數組執行一些操作,這樣我會得到像這樣的輸出[1,2,3,4, 4,3,2,1, 1,2]
。請你能提供一些方法來達到這個目的嗎?重複數組在上下有一些限制
// function declaration
function arrayExm(array,limit){
// want some operations here so that i will get this output
}
//function execution
arrayExm([1,2,3,4],10)
//so it will return [1,2,3,4, 4,3,2,1, 1,2]