I am trying to pass a rails array to a javascript function. The function will then use the array values in javascript so I need to keep it an array.
Here is how I am
bokor's answer works, but causes some linter and IDE errors if you want the array to be saved to a const, instead of a var / let.
const
var
let
The following variation seems to work and be compliant with the linters and IDEs that I am using.
const js_array = JSON.parse('<%= raw @object %>');