I have one object as below formate.
var pqr = {'1' : 'a1','b': 'b1'}
eval('pqr.1') //throw exception
eval('pqr.b') //This is working fine.
Please let me know why eval function throw an exception?
I have one object as below formate.
var pqr = {'1' : 'a1','b': 'b1'}
eval('pqr.1') //throw exception
eval('pqr.b') //This is working fine.
Please let me know why eval function throw an exception?
 
    
    You dont need eval here , if you still want to use it , use square braces , and to access b put it in a quotes otherwise b will be considered as variable 
var pqr = {
  '1': 'a1',
  'b': 'b1'
}
console.log(eval('pqr[1]')) //throw exception
console.log(eval('pqr["b"]'))