I need to have an array as following but the single quote before (s) causes error. JavaScript does not accept them. Is there any way to bypass the error or replace the single quotes with other characters like space?
I tried to use replace function but not sure how to use it. I used '
but it did not work.
var locations = [
[
'Alex's loc', '37.9908372',
'23.7383394', '0'
],
[
'John James's loc', '37.9908372',
'23.7383394', '1'
],
[
'Norman's loc', '38.075352',
'23.807885', '3'
],
[
'Jack Moore's loc', '37.9908372',
'23.7383394', '2'
]
];
Code
var locations = [
<c:forEach var="location" items="${locationes}" varStatus="loop">[
'${location.value.name}', '${location.value.latitude}',
'${location.value.longitude}', '${loop.index}', </c:forEach> ];
you can wrap the single quote with double quote, like: