<div id="month"></div>

<div id="month2"></div>

<div id="alpha"></div>

<div id="arr"></div>

<div id="arr2"></div>

<div id="yourArry"></div>

<div id="difference"></div>
//Add values into array
const months = ["Jan", "Feb", "April"];
months.splice(2, 0, "March");
console.log(months);
document.getElementById('month').innerHTML=months;

months.splice(4, 1, "May");
console.log(months);
document.getElementById('month2').innerHTML=months;

//Remove element
var alpha = ["A", "B", "C", "D", "E"];
var removed = alpha.splice(3, 1);
console.log(alpha);
document.getElementById('alpha').innerHTML=alpha;

//Remove from array by value
var arr = ["abc", "def", "ghi"];
arr.splice(arr.indexOf("def"), 1);
console.log(arr);
document.getElementById('arr').innerHTML=arr;

//Remove by index
var arr = ["abc", "def", "ghi"];
arr.splice(2, 1);
console.log(arr);
document.getElementById('arr2').innerHTML=arr;


//With the help you JQuery
$(document).ready(function() {
  var yourArry = [1, 2, 3, 4, 5];
  var removeItem = 2;

  yourArry = $.grep(yourArry, function(value) {
    return value != removeItem;
  });
  console.log(yourArry);
  document.getElementById('yourArry').innerHTML=yourArry;

  //Two array difference
  filesAry = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  newDelFilesAry = [5, 9, 1, 4];
  difference = [];
  $.grep(filesAry, function(el) {
    if ($.inArray(el, newDelFilesAry) == -1) difference.push(el);
  });
  console.log(difference);
  document.getElementById('difference').innerHTML=difference;
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://code.jquery.com/jquery-3.4.1.min.js