I have a problem when Im trying to convert a string to a variable in an array.
The variables are:
const n = 1; const s = -1;
The array string:
let walk = ['n', 's', 'n', 's', 'n', 's', 'n', 's', 'n', 'n'];
I want to convert automatically to this variable array:
let walk = [n, s, n, s, n, s, n, s, n, n];
I'm trying to split but the array still string not a var:
let text = walks.toString().split(',').join('-')
console.log(text)