var arr = ["name", "id"]; if (arr.indexOf("name") > -1) console.log('yeah'); else console.log('nah');