title: How to add properties dynamically in the object in javascript?
body: <p>I want to know that how many times each alphabet comes in the 'input' variable. For this I am loop through each character and storing them in an object and also how many they appeared in the sentence. But It is consoling NaN. Please show me where is the error?</p>
  
  <pre><code>var input = "why this kolaveri kolaveri di";
  function processData(input) {
      var object = {};
      input.replace(/\s/g,"").split("").forEach(function(item){
          object[item] == 'undefined' ? object[item] = 0 &amp;&amp; object[item]++ : object[item]++ ;
      });
      console.log(object);
  } 
  </code></pre>