The code ran in developer console is shown below. Why does parseInt
return the number present in [0]th index of a string but not return the number present in any other index in the string?
parseInt('i am 1 year old')
// output NaN
parseInt('1 year old')
// output 1
What is the reason why it behaves like this?