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

HW2 - Buckler #26

Open
wants to merge 3 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
30 changes: 26 additions & 4 deletions assignment/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,32 @@

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

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


var addMarkers = function(map) {};
// var jsonToCsv = function(json) { console.log(json); };
var jsonToCsv = function(json) {
let header = Object.keys(json[0]);
let list = [header];
for(let i =0; i < json.length; i++) {
temp = Object.values(json[i]);
list.push(temp);
};
console.log(list);
};

let makeMarkerDental = function(hcObj) {
return L.marker([hcObj.LAT, hcObj.LNG], {color: 'red', fillColor:"#f03"}).bindPopup(hcObj.NAME);
};

let makeMarker = function(hcObj) {
return L.marker([hcObj.LAT, hcObj.LNG], {color: 'green', fillColor: 'green'}).bindPopup(hcObj.NAME);
};

var addMarkers = function(map) {
for(let i = 0; i < healthCenters.length; i++) {
if(healthCenters[i]["DENTAL_PHONE"] != "N/A") {
makeMarkerDental(healthCenters[i]).addTo(map);
} else {makeMarker(healthCenters[i]).addTo(map); };
};
};

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

Expand Down
7 changes: 6 additions & 1 deletion lab/lab1/part1-types-variables-math.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,23 @@
===================== */

var a;
a = 31;
var resultTask1 = (a > 30);

var b;
b = "text";
var resultTask2 = (typeof b == 'string');

var c;
c = 5;
var resultTask3 = (c ** 2 == 25)

var d;
d = 10;
var resultTask4 = (d == 'cassiopeia'.length);

var e;
e = 13;
var resultTask5 = (e%5 == 3);

/* =====================
Expand Down
26 changes: 19 additions & 7 deletions lab/lab1/part2.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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);

Expand All @@ -17,7 +17,7 @@ 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);

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

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

var oddOrEven = function() {};
var oddOrEven = function(num3) {
if(num3 % 2 === 1) {return 'odd';}
else if (num3 % 2 === 0) {return 'even';}
else {return "error";}
};

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

Expand All @@ -40,7 +44,7 @@ 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(year) {return (2019 - year);};

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

Expand All @@ -49,7 +53,7 @@ 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(value) {return value > 9000;};

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

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


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

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

Expand All @@ -73,6 +83,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*x + b;
};

console.log('y success:', y(12, 1, 12) === 24);
15 changes: 14 additions & 1 deletion lab/lab2/part1-functions-are-values.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,21 @@
// works! You should see 'Success: true' if all goes well.

/* Define your function here */
var isString = function(aV) {
return typeof aV ==='string';
};

for (var i = 0; i < theArray.length, i++) { /* Inside the loop*/ }
var isNum = function(aV) {
return typeof aV === 'number';
};

var isArray = function(aV) {
return typeof aV === 'array';
}

for (var i = 0; i < theArray.length; i++) {
if()
}

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

Expand Down
Binary file added ~$README.md
Binary file not shown.