I am seeing something I don't understand when using the Google map API. I have the following code to pull the viewport...
var bounds = map.getBounds();
var viewport = {
top: bounds.getNorthEast().lat(),
right: bounds.getNorthEast().lng(),
bottom: bounds.getSouthWest().lat(),
left: bounds.getSouthWest().lng()
};
Turns out that viewport.top returns...
57.220445088498764 {
toJSON : function(key) { return this.valueOf(); } }
Can someone explain to me what this is? I don't completely understand js prototypes, but based on my limited understanding a js prototype is a function attached to an instance of an object. Since a number is an object, has Google placed a prototype function called 'toJSON' on all objects it returns?
How can I get rid of that so I end up with simply the number 57.220445088498764?
I am attempting to use the json2.js JSON.stringify, and it isn't giving proper JSON back because of this weird function.
delete Number.prototype.toJSON