JSFiddle - React, Tailwind, and code Playground

JavaScript

var data = [{
    "Key": "1111-1111-1111",
        "Email": "test@test.com"
}, {
    "Key": "2222-2222-2222",
        "Email": "test@boo.com"
}];


function getByKey(key) {    
    data.forEach(function (i, val) {
        if (data[val].Key === key) {
            return data[val].Key;
        } else {
            return "Couldn't find";
        }
    });

}

var asd = getByKey('1111-1111-1111');
console.log(asd);