📜  javascript代码示例中的unshift方法

📅  最后修改于: 2022-03-11 15:02:21.305000             🧑  作者: Mango

代码示例6
/*The unshift() adds method elements to the beginning, and push() method 
adds elements to the end of an array.*/
let twentyThree = 'XXIII';
let romanNumerals = ['XXI', 'XXII'];

romanNumerals.unshift('XIX', 'XX');
// now equals ['XIX', 'XX', 'XXI', 'XXII']

romanNumerals.push(twentyThree);
// now equals ['XIX', 'XX', 'XXI', 'XXII', 'XXIII']