diff --git a/assignment/images/dental.png b/assignment/images/dental.png new file mode 100644 index 0000000..40b1f28 Binary files /dev/null and b/assignment/images/dental.png differ diff --git a/assignment/index.html b/assignment/index.html index 33922b5..2d02cb4 100644 --- a/assignment/index.html +++ b/assignment/index.html @@ -43,6 +43,8 @@ in array form. For example, [{'first': 1, 'second': 44}, {'first': 2, 'second': 12}] becomes [['first','second'],[1, 44],[2, 12]] + + 2. Put a marker on the map for each health center in the specified lat/lng coordinates with a popup (a simple text dialog) that shows that location's name when its marker is clicked. @@ -62,10 +64,36 @@ ===================== */ - var jsonToCsv = function(json) { console.log(json); }; + var jsonToCsv = function(json) { + var outlist = []; + var mykeys = Object.keys(json[0]); + outlist.push(mykeys); + + for (i = 0; i < json.length; i++) { + var myvalues = Object.values(healthCenters[i]) + outlist.push(myvalues); + } + + console.log(outlist); + }; + + + var addMarkers = function(map) { + var dentalIcon = L.icon({ + iconUrl: 'images/dental.png', + iconSize: [40, 40] + }); + for (i = 0; i < healthCenters.length; i++) { + if (healthCenters[i].DENTAL_PHONE!="N/A") { + var marker = L.marker([healthCenters[i].LNG,healthCenters[i].LAT], {icon: dentalIcon}).addTo(map); + } else { + var marker = L.marker([healthCenters[i].LNG,healthCenters[i].LAT]).addTo(map); + } + marker.bindPopup(""+healthCenters[i].NAME+"").openPopup(); - var addMarkers = function(map) {}; + } + }; /* ===================== diff --git a/lab/lab1/part1-types-variables-math.html b/lab/lab1/part1-types-variables-math.html index 560cdde..3f5faca 100644 --- a/lab/lab1/part1-types-variables-math.html +++ b/lab/lab1/part1-types-variables-math.html @@ -18,19 +18,19 @@ ===================== */ - var a; + var a = 31; var resultTask1 = (a > 30); - var b; + var b = 'name'; var resultTask2 = (typeof b == 'string'); - var c; + var c = 5; var resultTask3 = (c ** 2 == 25) - - var d; + + var d = 10; var resultTask4 = (d == 'cassiopeia'.length); - var e; + var e = 18; var resultTask5 = (e%5 == 3); /* ===================== diff --git a/lab/lab1/part2-function-review.html b/lab/lab1/part2-function-review.html index 0d41bc0..422f317 100644 --- a/lab/lab1/part2-function-review.html +++ b/lab/lab1/part2-function-review.html @@ -4,7 +4,8 @@ Page Title +

Hello World - + diff --git a/lab/lab2/part1-functions-are-values.html b/lab/lab2/part1-functions-are-values.html index d0aec5e..c5ce605 100644 --- a/lab/lab2/part1-functions-are-values.html +++ b/lab/lab2/part1-functions-are-values.html @@ -38,7 +38,9 @@ exampleSum = exampleSum + arrayValue.length } else if (typeof arrayValue === 'number') { // Number case exampleSum = exampleSum + arrayValue - } else { // Otherwise + } else if (arraycondition) { + + } // Otherwise console.log("Not sure how to proceed with value:", arrayValue) } }