Return {hello: "world"}[something] - Javascript JSon

Javascript examples for JSon:JSon String

Description

Return {hello: "world"}[something]

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from w  ww  .j a va2 s.c  o m*/
      function parseMessage(error) {
          return {
              15: 'Faulted'
          }[error];
      }
      console.log(parseMessage(15))
    }

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

Related Tutorials