There is an array (in JavaScript) of elements written as follows:
var arr = [
[1, 2, 'abc', 3, 'cab'],
[3, 4, 'def', 5, 'ghi'],
];
There is a string variable that contains a string representation of the following element:
var s = "[6, 7, 'new', 8, 'something']";
How can I convert a string to a new "element" that can be placed in an arr array?
source
share