diff --git a/assignment/images/marker-icon1.png b/assignment/images/marker-icon1.png new file mode 100644 index 0000000..e2e9f75 Binary files /dev/null and b/assignment/images/marker-icon1.png differ diff --git a/assignment/images/marker-icon2.png b/assignment/images/marker-icon2.png new file mode 100644 index 0000000..97d04dc Binary files /dev/null and b/assignment/images/marker-icon2.png differ diff --git a/assignment/index.html b/assignment/index.html index 33922b5..6605276 100644 --- a/assignment/index.html +++ b/assignment/index.html @@ -62,20 +62,45 @@ ===================== */ - var jsonToCsv = function(json) { console.log(json); }; - var addMarkers = function(map) {}; + var csvHC = []; - /* ===================== + var jsonToCsv = (obj) => { + csvHC.push(Object.keys(obj[0])); + for (i = 0; i < obj.length; i++) { + csvHC.push(Object.values(obj[i])) + } + }; - End code + jsonToCsv(healthCenters); - ===================== */ + console.log(csvHC); + var myIcon1 = L.icon({iconUrl:'images/marker-icon1.png', + shadowUrl:'images/marker-shadow.png'}); + + var myIcon2 = L.icon({iconUrl:'images/marker-icon2.png', + shadowUrl:'images/marker-shadow.png'}); + + + var addMarkers = (obj) => { + for (var i = 1 ; i < obj.length; i++) { + if (obj[i][5]>=19140 && obj[i][5]<=19149) { + if (obj[i][8]!="N/A") { + L.marker([obj[i][1],obj[i][0]],{icon: myIcon1}).addTo(map) + .bindPopup(obj[i][3]) + } else { + L.marker([obj[i][1],obj[i][0]],{icon: myIcon2}).addTo(map) + .bindPopup(obj[i][3]) + } + } + } + } + + + addMarkers(csvHC); - jsonToCsv(healthCenters); - addMarkers(map); diff --git a/lab/lab1/part2.js b/lab/lab1/js/part2.js similarity index 87% rename from lab/lab1/part2.js rename to lab/lab1/js/part2.js index b1bccb9..f8901cc 100644 --- a/lab/lab1/part2.js +++ b/lab/lab1/js/part2.js @@ -7,7 +7,9 @@ Instructions: "Write a function that adds one to the number provided" Example: "plusOne(2) should return 3" ===================== */ -var plusOne = function() {}; +var plusOne = function(num) { + return num + 1; +}; console.log('plusOne success:', plusOne(99) === 100); @@ -17,7 +19,9 @@ Example: "plusTwo(2) should return 3" NOTE: Try using the `plusOne` function in the body of your `plusTwo` function ===================== */ -var plusTwo = function() {}; +var plusTwo = function(num) { + return num + 2; +}; console.log('plusTwo success:', plusTwo(99) === 101); @@ -28,7 +32,12 @@ if so, it returns even or odd depending on the number, otherwise it returns "err ===================== */ -var oddOrEven = function() {}; +var oddOrEven = function(i) { + if (i % 2 == 0); { + return 'even' + } else { + return 'odd';} +}; console.log('oddOrEven success:', oddOrEven(100) === 'even' && oddOrEven(201) === 'odd'); @@ -49,7 +58,13 @@ Instructions: "Write a function that returns true for numbers over 9000 and fals Example: "over9000(22) should return false" ===================== */ -var over9000 = function() {}; +var over9000 = function(num) { + if (num > 9000); { + return true; + } else { + return false; + } +}; console.log('over9000 success:', over9000(9001) === true && over9000(12) === false); diff --git a/lab/lab1/part1-types-variables-math.html b/lab/lab1/part1-types-variables-math.html index 560cdde..082317c 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 = 'hah'; 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 = 8; var resultTask5 = (e%5 == 3); /* ===================== diff --git a/lab/lab1/part2-function-review.html b/lab/lab1/part2-function-review.html index 0d41bc0..b33b15d 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..9c88b29 100644 --- a/lab/lab2/part1-functions-are-values.html +++ b/lab/lab2/part1-functions-are-values.html @@ -38,7 +38,10 @@ exampleSum = exampleSum + arrayValue.length } else if (typeof arrayValue === 'number') { // Number case exampleSum = exampleSum + arrayValue - } else { // Otherwise + } else if (arraycondition) { + exampleSum = exampleSum + arra + } + else { // Otherwise console.log("Not sure how to proceed with value:", arrayValue) } } @@ -68,7 +71,7 @@ /* Define your function here */ - for (var i = 0; i < theArray.length, i++) { /* Inside the loop*/ } + for (var i = 0; i < theArray.length; i++) { /* Inside the loop*/ } /* =====================