I have an array like this:
const arr = [1,2,3,4,5]
I want to achieve something like this:
let answer = 1,2,3,4,5
I want the typeof answer to be a number.
I have an array like this:
const arr = [1,2,3,4,5]
I want to achieve something like this:
let answer = 1,2,3,4,5
I want the typeof answer to be a number.
let answer = "1,2,3,4,5"
is possible but not what you asked.
const arr = [1,2,3,4,5];
let answer = arr.join(',');
console.log(answer);