title: Adding a name value pair to an array object in JSON using JAVASCRIPT
body: <p>I want to implement this :
  "Check the key name default  is available or not, if available then add one more key in same object. => ("pin" : 91) " on the json given below. I have tried the following code.</p>
  
  <pre><code>var myObj = {
       "data": [{
           "code": "EN",
           "language": "English",
           "content_available": true,
           "isdefault": true
       }, {
           "code": "AR",
           "language": "Arabic",
           "content_available": true,
           "isdefault": false,
                  "default" : true
  
       }, {
           "code": "BR",
           "language": "Brazilian Portuguese",
           "content_available": true,
           "isdefault": false
       }, {
           "code": "CN",
           "language": "Simplified Chinese",
           "content_available": true,
           "isdefault": false,
                  "default" : true
       }, {
           "code": "TW",
           "language": "Traditional Chinese",
           "content_available": true,
           "isdefault": false
       }, {
           "code": "DE",
           "language": "German",
           "content_available": true,
           "isdefault": false
       }, {
           "code": "ES",
           "language": "Spanish",
           "content_available": true,
           "isdefault": false
       }, {
           "code": "FR",
           "language": "French",
           "content_available": true,
           "isdefault": false
       }, {
           "code": "JP",
           "language": "Japanese",
           "content_available": true,
           "isdefault": false,
                   "default" : true
       }, {
           "code": "RU",
           "language": "Russian",
           "content_available": false,
           "isdefault": false
       }],
       "success": true
   }
  function addKey(k) {
    for (var key in myObj.data) {
      if (myObj["data"][key] === k) {
        myObj["data"][key]["pin"] = "91";
      }
    }
  }
  addKey("default");
  console.log(myObj);
  </code></pre>