Check whether a Javascript object has a value for a given key - Javascript Object

Javascript examples for Object:Object Literal

Description

Check whether a Javascript object has a value for a given key

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
var mmap = new Object();
mmap['Q'] = 1;//from w ww  .  j  a v  a 2 s .  co  m
mmap['Z'] = 0;
mmap['L'] = 7;
console.log(mmap['Z'] === undefined);
console.log(mmap['X'] === undefined);

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials