I want to find the same object in an array and remove it from the array. Here is an example.
var previousSelectedWords = [{ 'id': 33, 'name': "美白", 'kana': "ビハク", 'type': 'new'}, { 'id': 3, 'name': "テスト", 'kana': "テスト", 'type': 'new'}, { 'id': 34, 'name': "免疫力", 'kana': "メンエキリョク", 'type': 'old'}];
var checkCurrentWord = { 'id': 3, 'name': "テスト", 'kana': "テスト", 'type': 'new'};
var foundWordIndex = $.inArray(checkCurrentWord, previousSelectedWords)
Looks like $.inArray
doesn't work with objects. It always gives me -1
id
and name
, and kana
can be the same, only type
is unique.