I'm trying to convert a string of numbers into an array of elements with each number. I thought parseInt would convert the string to numbers but I'm a bit lost now.
const str = '1 2 3 4';
let words = parseInt(str);
words = str.split(' ');
which results in
Array ["1", "2", "3", "4"]
However, I would like the result to be
[1, 2, 3, 4]