Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

Glasgow-6_JS1-Week-4_Ehdaa-Sakawi #237

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Ehdaa-Munier
Copy link

No description provided.

Copy link

@annacollins85 annacollins85 left a comment

Choose a reason for hiding this comment

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

Well done! I have added some comments and some answers to some of the questions. I see you had a little trouble with 6-journey-planner.js. Maybe we can have a look at this in a buddy session. Or I advise you to ask some of your classmates about how they implemented it when you're in class on Saturday.

function remove() {
function remove(array, index) {

return array.slice(0, index).concat(array.slice(index + 1));

Choose a reason for hiding this comment

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

Nice way of doing it

function remove() {
function remove(array, index) {

return array.slice(0, index).concat(array.slice(index + 1));

Choose a reason for hiding this comment

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

Nice way of doing it 👏

Comment on lines +67 to +68
numbersWithPercentages = numbers.map(addPercentage);
return numbersWithPercentages;

Choose a reason for hiding this comment

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

Here we could simply return the map directly without saving it in a variable and then returning that.
numbers.map(addPercentage);

Good use of map though 👏

function findSafeOxygenLevel(result) {
if(value > 19.5 && value < 23.5)
return result === "%", " . ";
}

Choose a reason for hiding this comment

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

Here the function should take an array of percentages as an input (see tests for examples below). So first we need to turn the percentage which is currently a strings into a number. We need to find the first number in the array that is between 19.5 and 23.5. parseFloat will turn a percentage into a number, e.g. parseFloat("25%") === 25

function findSafeOxygenLevel(planetPercentages) {
  return planetPercentages.find(function(percentage) {
    const number = percentage.parseFloat(percentage)
    return (number >= 19.5 && number <= 23.5) // This will return true or false, if it returns true, the `find` array function will return it as the element it finds first
  })
}

Comment on lines +26 to +31

if (berryArray.every((berry) => berry === "pink")) {
return "Bush is safe to eat from";
} else {
return "Toxic! Leave bush alone!";
}

Choose a reason for hiding this comment

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

Great!

Comment on lines +12 to +13
const eligibleAttendance = attended.filter(attendance => attendance[1] >= 8);
return eligibleAttendance.map(names=> names[0])

Choose a reason for hiding this comment

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

Great 👏

Comment on lines +9 to +11
function getLanes(streetNames) {
return streetNames.filter((street) => street.includes("Lane"));
}

Choose a reason for hiding this comment

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

👏

Comment on lines +8 to +9
let copyOfOriginal = Arr.slice(0, 5); {
return copyOfOriginal;

Choose a reason for hiding this comment

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

👏

Comment on lines +20 to +23
function sortArray(letters) {
let copyOfOriginal = [...letters];
copyOfOriginal.sort();
return copyOfOriginal;

Choose a reason for hiding this comment

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

This is good. We could also have just directly returned the sorted version like this

Suggested change
function sortArray(letters) {
let copyOfOriginal = [...letters];
copyOfOriginal.sort();
return copyOfOriginal;
function sortArray(letters) {
let copyOfOriginal = [...letters];
return copyOfOriginal.sort();
}

function tidyUpString(array) {


return array.map((string) => string.trim().toLowerCase().replace("/", ""));

Choose a reason for hiding this comment

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

Good use of method chaining! 👏

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants