I need to print a string array inside a JavaScript wihout the string quotes.
I have an array containing string values and it is embedded to the page as <%= array %>. For the script, the array should printed in form of [[value1], [value2], [value3]] etc but when I output the array it adds quotes around the values so the script doesn't work.
How can I remove the quotes from the output?
I am not sure if I understand you right, but when outputting the array, you could do e.g.:
array = ["value1", "value2"]
array.to_s.gsub('"', '')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With