javascript数组相关总结

97 阅读1分钟

数组有三个属性: constructor, length, prototype

有14个方法:concat(), join(), pop(), push(), reverse(), shift(), slice(), sort(), splice(),toSource(), toString(), toLocalString(), unshift(), valueOf()

其中改变原有数组的方法有7个:pop(), push(), shift(), reverse(), sort(), splice(), unshift()

其中不改变原数组的方法有7个: concat(), join(), slice(), toSource(), toString(), toLocalString(), valueOf()

其中作用相反的几对有:pop() 和 shift() push() 和 unshift()

作用相近的有:join()、 toString()、toLocalString()

容易混淆的有:slice() 和 splice()

和顺序有关的有: sort() , reverse()