JavaScript is in array
As mentioned before, if your browser supports indexOf()
, great!
If not, you need to pollyfil it or rely on an utility belt like lodash/underscore.
Just wanted to add this newer ES2016 addition (to keep this question updated):
Array.prototype.includes()
if (blockedTile.includes("118")) {
// found element
}
Try this:
if(blockedTile.indexOf("118") != -1)
{
// element found
}