JSFiddle - React, Tailwind, and code Playground

by Md Shah

JavaScript

var MyArray = {
    id1: 'apple',
    id2: 'orange',
    id3: 'apple'
};

var matchElement = 'apple';
var output = [];

$.each(MyArray, function (i, v) {

    if (v == matchElement) {
        output.push(i);
    }
});

alert(output);