JavaScript method to delete array elements by value
- 2020-06-01 08:11:53
- OfStack
This example demonstrates how JavaScript deletes array elements by value. Share with you for your reference. The specific implementation method is as follows:
function ArrayRemoveByValue(str_value,arr_remove){
var num_to_del =new RegExp(str_value);
var db_d =new RegExp('\,{2}');
var se_d =new RegExp('(^\,)|(\,$)');
arr_ret = arr_remove.toString().replace(num_to_del,'').replace(db_d,',').replace(se_d,'').split(',');
return arr_ret;
}
I hope this article has been helpful to your javascript programming.