alert('欢迎'+arr.sort().slice(0,3) + '和' + arr.sort().slice(3) + '同学!');
为什么要加sort()呢? alert('欢迎'+arr.slice(0,3) + '和' + arr.slice(3) + '同学!');不是已经可以?
题目有写要排序的。请看清楚题目
Sign in to make a reply
隐形蚂蚱
alert('欢迎'+arr.sort().slice(0,3) + '和' + arr.sort().slice(3) + '同学!');