I was processing some data and I have filtered the data to a point where I have stored the data which should be the keys of the JSON file I want to create into an array like this
[
'A',
'B',
'C',
'D',
'E'
]
Now I want to set these array values as keys dynamically to create a JSON with other data
Oh this is specific to the data I have. My data includes an array full of strings but some of the data are ‘1’, ‘2’ etc…
So I wanted to split the data at that point so I put it like that for testing
I saw that if we multiply a string with a number we would get NaN unless the string contains the number so I thought this check would be a good point to split the data
Instead of relying upon implicit conversion, try using explicit conversion. Googling something like ‘convert string to number, JavaScript’ is where I’d start - I never remember exact function names.