153
rated 0 times
[
157]
[
4]
/ answers: 1 / hits: 17276
/ 8 Years ago, thu, november 24, 2016, 12:00:00
i am getting the following error
Parse error: Unexpected token operator «=», expected punc «,» Line
159, column 26
This is my code
function fitBounds(type=all, shape=null) {
var bounds = new google.maps.LatLngBounds();
if ( type == all ){
if ((circles.length > 0) | (polygons.length > 0)){
$.each(circles, function(index, circle){
bounds.union(circle.getBounds());
});
$.each(polygons, function(index, polygon){
polygon.getPath().getArray().forEach(function(latLng){
bounds.extend(latLng);
});
});
}
}
else if ( (type == single) && (shape != null) ) {
if (shape.type == google.maps.drawing.OverlayType.MARKER) {
marker_index = markers.indexOf(shape);
bounds.union(circles[marker_index].getBounds());
}
else {
shape.getPath().getArray().forEach(function(latLng){
bounds.extend(latLng);
});
}
}
if (bounds.isEmpty() != true)
{
map.fitBounds(bounds);
}
}
More From » jslint