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

Scott M-Week 2 #30

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
18 changes: 17 additions & 1 deletion assignment/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,25 @@
===================== */

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


var addMarkers = function(map) {};
//Part 1
//Log a series of arrays to the console that represents the health_centers dataset in array form.
//Code guidance: https://openclassrooms.com/en/courses/3523231-learn-to-code-with-javascript/3703666-store-data-in-arrays

for (var i = 0; i < healthCenters.length; i=i+1) {//sets loop through each element starting at 0 (i=0) for full length of array minus 1 (last value)
console.log(healthCenters[i]);//logs to console set of health centers in array form
Copy link
Member

Choose a reason for hiding this comment

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

This does not produce an array of arrays.

Your results console log each object as such:

image

We are looking for you to produce an array of arrays as such:

image

Copy link
Author

Choose a reason for hiding this comment

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

I just added a revision that I believe addresses the issue. I initially did not see that the push worked so I pushed it twice...second only has a change in spacing.
image

}

//Part 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.
//Code guidance: https://leafletjs.com/examples/layers-control/ & https://leafletjs.com/examples/custom-icons/

var addMarker = function(x) { return L.marker([x.LAT, x.LNG]).bindPopup(x.NAME) }//function that returns a marker (lat,lng) and popup (name) for a variable
for (var i=0; i <healthCenters.length; i = i+1) { addMarker(healthCenters[i]).addTo(map) }//uses function to add marker and popup for each variable in array and adds to 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 = "abc";
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 = 28;
var resultTask5 = (e%5 == 3);

/* =====================
Expand Down
6 changes: 3 additions & 3 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,7 @@ if so, it returns even or odd depending on the number, otherwise it returns "err

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

var oddOrEven = function() {};
var oddOrEven = function isInt8(n) {return +n === n && !(n % 1)};

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

Expand Down
2 changes: 1 addition & 1 deletion lab/lab2/part1-functions-are-values.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,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