if ('X' in mmap)
{
// ...
}
Here is an example on JSFiddle.
hasOwnProperty is also valid, but using in is much more painless. The only difference is that in returns prototype properties, whereas hasOwnProperty does not.
if ('X' in mmap)
{
// ...
}
Here is an example on JSFiddle.
hasOwnProperty is also valid, but using in is much more painless. The only difference is that in returns prototype properties, whereas hasOwnProperty does not.