DEV Community

Discussion on: 5 useful javascript tricks for begginers.

Collapse
baikai223 profile image
baikai223

获取数组的最后一项数据使用数组的api方法不是更好吗?arr.pop()

Collapse
ratuloss profile image
Ratul Author

I don't understand what you have said :|

Collapse
baikai223 profile image
baikai223

Wouldn't it be better to use pop() instead of slice()?

Thread Thread
ratuloss profile image
Ratul Author

you can use what ever you want. ......I know how to do that with slice so I have shown with slice. If you know how to do that with pop() you can use pop. :)

Some comments have been hidden by the post's author - find out more