0

eval method of JavaScript return wrong output

eval(19 > 0022)

the above code returns true. Is there any way to fix this.

Thanks for all your comments its fixed now. with these comments

const b = '0022'.replace(/^[0]+/g,"");

and

eval(Number('19') > Number('0022'))

Sandeep Bhardwaj
  • 1,310
  • 1
  • 18
  • 24

0 Answers0