title: How to access multi-valued dictionaries in javascript?
body: <p>I have the following dictionary:</p>
  
  <pre><code>{1:['a&amp;b','b-c','c-d'],2:['e orf ','f-k-p','g']}
  </code></pre>
  
  <p>I want to print the key and values from this dictionary
  I tried the following code:</p>
  
  <pre><code>for (var key in dictionary) {
      // check if the property/key is defined in the object itself, not in parent
      if (dictionary.hasOwnProperty(key)) {           
          console.log(key, dictionary[key]);
      }
  }
  </code></pre>
  
  <p>I am just getting some random numbers.How could I solve it?
  My output:</p>
  
  <pre><code>key:34639values:mkey:34640values:akey:34641values:tkey:34642values:hkey:34643values:ekey:34644values:mkey:34645values:akey:34646values:tkey:34647values:ikey:34648values:ckey:34649values:skey:34650values: key:34651values:pkey:34652values:rkey:34653values:okey:34654values:bkey:34655values:lkey:34656values:ekey:34657values:mkey:34658values:
  </code></pre>
  
  <p>I want the output as:</p>
  
  <pre><code>keys: 1,2
  values: ['a&amp;b','b-c','c-d'],['e orf ','f-k-p','g']
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var dictionary = {1:['a','b','c'],2:['e','f','g']}
  for (var key in dictionary) {
      // check if the property/key is defined in the object itself, not in parent
      if (dictionary.hasOwnProperty(key)) { 
          console.log(`key: `, key);
          console.log(`values: `, dictionary[key]);
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Edit:
  Actually the dictionary is taken as string. How can I typecast it to dictionary?</p>