title: Dynamically Insert and Retriev the key value pair from array - Javascript
body: <p>Trying to insert dynamic Key and values into array object in the html page.</p>
  
  <pre><code>    var answers=[];
  
      $(".btn-like, .btn-dislike").click(function() {
          var $this = $(this);
          var value = $this.text();
          var inter_data_type = $this.parent().attr('id');
  
            if(!inter_data_type in answers) {
              answers.push({"inter_data_type":value});
            }
           alert(answers); //displaying [object][object]
           alert(answers.inter_data_type); // displaying undefined
      });
  </code></pre>
  
  <p>Need to check whether key is exists in array or not before insert it, if key and value are present then no need to insert it, if the key is same and value is different then need to replace the value for particular key. but above code not working.
  Even though if it inserts into array not able to get the value.</p>