thomaseng
No Smoking , New Live !

导航

 

先上图:

代码演示:


运行结果

var
arr=[]; arr.push('tom','james','alen','peter'); console.log(arr.length);
//这里toString()一下,不然用console.log()就看不到效果了
console.log(arr.toString());
console.log('----------------'); //pop console.log('pop:'+arr.pop()); console.log(arr.length); console.log(arr.toString()); console.log('----------------'); //shift console.log('shift:'+arr.shift()); console.log(arr.length); console.log(arr.toString()); console.log('----------------'); //unshift console.log('unshift:lily,lucy'); arr.unshift('lily','lucy'); console.log(arr.length); console.log(arr.toString()); console.log('----------------'); //shift console.log('shift:'+arr.shift()); console.log(arr.length); console.log(arr.toString());

 

 

posted on 2013-04-08 03:54  thomaseng  阅读(429)  评论(0编辑  收藏  举报