Splunk Interview Question

What is the value of ['1', '2', '3'].map(parseInt)

Interview Answer

Anonymous

Sep 27, 2019

I could not answer it actually produces [1, NaN, NaN] because map provides 3 arguments, and parseInt accepts 2, with the first one being the value you want parsed and the second being the radix. Also because a radix of 0 technically would cause [NaN, NaN, NaN], i believe the interviewer told me that the radix is defaulted to something else if the argument provided is 0.