Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homework02-Xiaoqi Tang #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assignment/images/dental.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 30 additions & 2 deletions assignment/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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("<b>"+healthCenters[i].NAME+"</b>").openPopup();

var addMarkers = function(map) {};
}
};

/* =====================

Expand Down
12 changes: 6 additions & 6 deletions lab/lab1/part1-types-variables-math.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/* =====================
Expand Down
3 changes: 2 additions & 1 deletion lab/lab1/part2-function-review.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<title>Page Title</title>
</head>
<body>
<h1> Hello World
<!-- Javascript Imports -->
<script src="part2.js"></script>
<script src="js/part2.js"></script>
</body>
</html>
4 changes: 3 additions & 1 deletion lab/lab2/part1-functions-are-values.html
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down