更新时间:2023-02-18 08:52:37
这可以使用Array对象的indexOf和splice函数来实现.以下是同时使用Lodash和javascript函数的实现
This can be achieved using indexOf and splice functions of an Array object. Below are the implementation using both Lodash and javascript functions
blogArray.splice(0,blogArray.indexOf(matchingEl))
_.slice(blogArray, 0, _.findIndex(blogArray, function(k){return k == matchingEl;})