<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<!-- the Google Map will be displayed here -->
<div id="google_map">
</div>
<!-- this section will be used for logging purpose -->
<section id="console">
</section>
//SOLUTION BY: PRAVEEN SALITRA
var MYAPP = {
map: null,
//can be useful to save a reference to the Google Map object
data: { //the definition of the points of interest that have to be displayed
'banks': [
{
lat: 29.14505,
lng: -82.189993},
{
lat: 29.653236,
lng: -82.422619}
],
'universities': [
{
lat: 29.679888,
lng: -82.430461}
],
'power companies': [
{
lat: 29.203575,
lng: -81.039404},
{
lat: 28.538235,
lng: -81.377389}
]
},
log: function(message) {
//The code to display log messages in the logging area should go here
if (message == 'countPOI') { //task1:Printing # of point of interests
var A = [],
temp;
var totalPOI = 0;
//traversing the data
for (var p in this.data) {
if (p) {
temp = this.data[p];
A[A.length] = p + ': ' + temp.length;
totalPOI += temp.length;
}
}
var str = 'Total # of Point of Interests : ' + totalPOI + '<BR> <B>CATEGORY-WISE</B><BR>' + A.join('<BR>');
//print this info to console
document.getElementById("console").innerHTML = str;
}
else {
//for some other cases, if any
document.getElementById("console").innerHTML = message;
}
},
google_init: function(centerLat, centerLng) {
//The code to initialize a Google Map centered in centerLat, centerLng
//should go here
var myOptions = {
zoom: 1,
center: new google.maps.LatLng(centerLat, centerLng),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
this.map = new google.maps.Map(
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.