i'm trying to match the value of variable to an object array. the last if statement is what i'm struggling with. anything helps thanks in advance.
function getPage(){
let pageActual = window.location.href;
console.log(pageActual);
let pageName = /500(.*)/;
let EventName = pageName.exec(pageActual); // this creates the event name based on the event url you're currently on.
console.log(EventName[1]);
const events2020v2 = [
{event:"example1", Date:'February 19, 2020'},
{event:"test2.html", Date:'February 11, 2020'},
{event:"example3", Date:'February 19, 2020'},
{event:"/test2.html", Date:'February 19, 2020'},
{event:"example4", Date:'February 19, 2020'}
];
// below im attempting to match the eventName to a value in the object above.
if(events2020v2.event.indexOf(EventName.value)){
console.log('something')
}