How can I print a JS array (["a", "b", "c"]) exactly to a string.
When I do ["a", "b", "c"].toString() I will get 'a,b,c'
I want the string: ["a", "b", "c"]
There is probably a neat method but I can't think of one.
If ["a","b","c"] is good enough, you could simply use JSON.stringify():
const arr = ["a", "b", "c"];
const str = JSON.stringify(arr);
console.log(str);
JSON.stringify([...])?join,array + ""etc'["' + input.join('", "') + '"]'