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

Week 2 - Hartofelis #33

Open
wants to merge 4 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
29 changes: 24 additions & 5 deletions assignment/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,30 @@
Start code

===================== */
var jsontoCsv = function(json) {console.log(json); };
var jsonToCsv = function(json) {
var x = [];
x.push(Object.keys(json[0]));

for (var i in json) {
x.push(Object.values(json[i]));
}
console.log(x);
};

// not done yet need to test and see that it shows up in array form -- with titles coming across the top, and each one in a list

var makeAMarker = (obj) => {
return L.circleMarker([obj.LAT, obj.LNG],{
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5,
radius: 15
} ).bindPopup(obj.NAME)}
for (i = 0; i < healthCenters.length; i = i+ 1) { makeAMarker(healthCenters[i]).addTo(map)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Except I believe this line is unnecessary. It looks like you are adding each of the markers twice. Once with line 84 and once with line 86.

var markers = healthCenters.map(makeAMarker);
markers.forEach((marker) => { marker.addTo(map)})

var jsonToCsv = function(json) { console.log(json); };


var addMarkers = function(map) {};

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

Expand All @@ -75,7 +94,7 @@


jsonToCsv(healthCenters);
addMarkers(map);
makeAMarker(map);
</script>
<!--Your code ends here-->
</body>
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 = 43;
var resultTask1 = (a > 30);

var b;
var b = 'words';
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);

/* =====================
Expand Down
39 changes: 32 additions & 7 deletions lab/lab1/part2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(n) {
return n + 1;
};

console.log('plusOne success:', plusOne(99) === 100);

Expand All @@ -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(n) {
return n + 2;
};

console.log('plusTwo success:', plusTwo(99) === 101);

Expand All @@ -28,7 +32,13 @@ if so, it returns even or odd depending on the number, otherwise it returns "err

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

var oddOrEven = function() {};
var oddOrEven = function(n) {
if (n%2 === 0) {
return 'even';
} else {
return 'odd';
}
};

console.log('oddOrEven success:', oddOrEven(100) === 'even' && oddOrEven(201) === 'odd');

Expand All @@ -40,7 +50,10 @@ Instructions: "Write a function, age, that takes a birth year and returns an age
Example: "age(2000) should return 17"
===================== */

var age = function() {};
var age = function(birthYear) {
var currentYear = 2019;
return currentYear - birthYear;
};

console.log('age success:', age(1971) === 48);

Expand All @@ -49,7 +62,12 @@ 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(n) {
if (n > 9000) {
return true;} else {
return false;
}
};

console.log('over9000 success:', over9000(9001) === true && over9000(12) === false);

Expand All @@ -61,7 +79,12 @@ and if it is not, it prints to the console, "TRY WITH STRINGS"
===================== */


var trump = function() {};
var trump = function(n) {
if (typeof n === 'string'){
return n.toUpperCase;} else {
return 'TRY WITH STRINGS';
}
};

console.log('trump success:', trump(12) === "TRY WITH STRINGS" && trump('hi') === 'HI');

Expand All @@ -73,6 +96,8 @@ Example: "y(0, 0, 0) should return 0; y(1, 1, 1) should return 2"
===================== */


var y = function(m,x,b) {};
var y = function(m,x,b) {
return m + b;
};

console.log('y success:', y(12, 1, 12) === 24);
7 changes: 5 additions & 2 deletions lab/lab2/part1-functions-are-values.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 + arryValue.length
}
else{ // Otherwise
console.log("Not sure how to proceed with value:", arrayValue)
}
}
Expand Down Expand Up @@ -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*/ }

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

Expand Down