I have a ruby code that will generate an array.I need to use that array in javascript.
<%= region.zip(min, max).select {|_, a, b| a == '0' && b == '0'}.map(&:first)%>;
This above code will generate an array like this
["A", "B", "C", "F", "H"]
Here is the demo http://repl.it/t03/680
I want to use this array in javascript. Below is what I tried and the error I got in console.
<script>
var output = <%= (region.zip(min, max).select {|_, a, b| a == '0' && b == '0'}.map(&:first)).gsub('"', '') %>;
</script>
Error is
SyntaxError: expected expression, got '&'
var output = ["A", "B", "C", "F
Thanks