javascript - i want to remove double quotes from a string without replace function -


i want remove double quote string "hello" word.

i have array var ary = ['a', 'b' , 'c'] when take value array it's return string if use ary[0] = "a" want in value a .

because have 1 json file contains

{    "a":{        "name" : "emma"      },    "b":{        "name" : "harry"      },    "c":{        "name" : "jonny"      }  } 

i want value here using array ary[0].name = emma

note : used str.replace(/\"/gi,""); && str.replace(/"/gi,""); if other idea how can please replay asap.

if understood requirement correctly, can use bracket notation obj['a'].name

var obj = {     a: {         "name": "emma"     },     b: {         "name": "harry"     },     c: {         "name": "jonny"     } };  var ary = ['a', 'b', 'c']  (var = 0; < ary.length; i++) {     console.log(obj[ary[i]].name) } 

here pass property key string bracket notation , return value


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -