JSFiddle - React, Tailwind, and code Playground

by bobbyrne01

HTML

<div id="result"></div>

JavaScript

/*
 * Dataset
 */
var markedTabs = [];
markedTabs.push({
    url: "google.com"
});
markedTabs.push({
    url: "example.com"
});


/*
 * First method
 */
var result = false;
for (var i = 0; i < markedTabs.length; i++) {
    if (markedTabs[i].url === 'example.com') {
        result = true;
    }
}
document.getElementById('result').innerHTML = result;



/*
 * Second method
 */
if (markedTabs.indexOf('example.com') >= 0){
    alert('found');
}