JSFiddle - React, Tailwind, and code Playground

by ysuper

HTML

<h2>
javascript 移除陣列中 某值方式
</h2>

JavaScript

var y = [1, 2, 3, 2, 2, 4]
var removeItem = 2;

alert('Array before removing the element = '+y);
y = jQuery.grep(y, function(value) {
  return value != removeItem;
});
alert('Array after removing the element = '+y);