I trying to remove array square bracket at beginning and end.
EX: [['moe', 30], ['larry', 40], ['curly', 50]]
Need: ['moe', 30], ['larry', 40], ['curly', 50]
If it is a string you can use the substring
or slice
method like this:
var yourString = "[['moe', 30], ['larry', 40], ['curly', 50]]"; // using substring var result = yourString.substring(1, yourString.length-1); console.log(result); // using slice var result2 = yourString.slice(1, -1); console.log(result2);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.