var itemarrays=["足球","篮球","网球"];
有没有一个函数可以删除里面的值呢?
例如
itemarrys.del("篮球")这样子
目前我是用jquery的$.inArray("");
var index=$.inArray("篮球",itemarrays)
返回key然后再用.
itemarrys.splice(index,1);
删除
但是我觉得这样不够漂亮。请问有没有简单点的方法呢?
.del()是不是一定要自己写呢?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
javascript数组操作怎么删除特定的值-PHP中文网问答-javascript数组操作怎么删除特定的值-PHP中文网问答
围观一下哦,学习一下。
itemarrays.splice(itemarrays.indexOf('篮球'),1)