html javascript - array sort, reverse
function init() { const arr0 = ['car','bus','aircraft','spacecraft','car1','motorcycle','car'] const arr1 = [ {name: 'car', type: 'land', cost: 100}, {name: 'bus', type: 'land', cost: 50}, {name: 'aircraft', type: 'sky', cost: 200}, {name: 'motorcycle', type: 'land', cost: 80}, {name: 'spacecraft', type: 'space', cost: 1000} ] const arr2 = [5,3,21,6,50,100,1,10,12,20,..
html javascript - array concat
const arr0 = [1,2,3]const arr1 = [4,5,6]const arr2 = [7,8,9]const arr3 = arr0.concat(arr1, arr2)const arr4 = arr1.concat(arr2, arr0)const arr5 = arr0.concat(arr0, arr0)console.log(arr3) // [1,2,3,4,5,6,7,8,9]console.log(arr4) // [4,5,6,7,8,9,1,2,3]console.log(arr5) // [1,2,3,1,2,3,1,2,3]