To split and modify a string in Node, we call the
For instance, we write
const str = "123, 124, 234,252"; const arr = str.split(",").map((val) => Number(val) + 1); console.log(arr);
split to split the
str string by the commas into a string array.
And then we call
map to map each value to their new value by converting them to a number and add 1 to it.