📜  javascript slice() 函数 - Javascript 代码示例

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

代码示例1
var fruits = new Array ( "apple", "pear", "orange", "banana" );
alert ( fruits.slice ( 1, 3 ) )  // Displays "pear,orange"
alert ( fruits.slice ( 0, -2 ) ) // Displays "apple,pear"
alert ( fruits.slice ( 2 ) )     // Displays "orange,banana"