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

NW6 | Rabia Avci | JS2 Module | [TECH ED]Complete week 2 exercises | Week 2 #231

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

Conversation

RbAvci
Copy link

@RbAvci RbAvci commented Mar 6, 2024

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

Copy link

netlify bot commented Mar 6, 2024

Deploy Preview for cute-gaufre-e4b4e5 ready!

Name Link
🔨 Latest commit e233f38
🔍 Latest deploy log https://app.netlify.com/sites/cute-gaufre-e4b4e5/deploys/65e835f4f4fd4700084282cf
😎 Deploy Preview https://deploy-preview-231--cute-gaufre-e4b4e5.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

const firstIndex = Math.floor(middleIndex);
const secondIndex = Math.round(middleIndex);

return (list[firstIndex-1]+list[secondIndex-1])/2;
Copy link

Choose a reason for hiding this comment

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

Looking great 👍

Copy link

@Ara225 Ara225 left a comment

Choose a reason for hiding this comment

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

Brillant work as always


test("given an array with strings or numbers, it removes the duplicate values", () => {
expect(dedupe([5, 1, 'a', 'a', 2, 'b', 3, 3, 8, 8])).toStrictEqual([5, 1, 'a', 2,'b', 3, 8]);
});
Copy link

Choose a reason for hiding this comment

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

👍

output.push(input[i]);
}
}
return Math.max(...output);
Copy link

Choose a reason for hiding this comment

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

Amazing, don't forget to tidy commented out code :)


test("given an array with non-number values, returns max, ignore non-numeric values", () => {
expect(max(["17", 12, "c", 5.4])).toBe(12);
});
Copy link

Choose a reason for hiding this comment

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

👍




module.exports = sum;
Copy link

Choose a reason for hiding this comment

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

👍


test("given an array with non-number values, returns the sum of the numerical elements, ignore non-numeric values", () => {
expect(sum(["17", 12, "c", 5.4])).toBe(17.4);
});
Copy link

Choose a reason for hiding this comment

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

👍


test.todo("creates a country currency code lookup for multiple codes");
module.exports = createLookup;
Copy link

Choose a reason for hiding this comment

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

👍

CA: "CAD",
GB: "GBP",
});
});
Copy link

Choose a reason for hiding this comment

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

👍

return counts;
}

module.exports= tally;
Copy link

Choose a reason for hiding this comment

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

👍


test("When passed an invalid input like a string to tally, it should throw an error", () => {
expect(() => { tally("invalid input");}).toThrow("Input must be an array");
})
Copy link

Choose a reason for hiding this comment

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

Solid tests as always :)

// d) Explain why the current return value is different from the target output

// he current return value is different from the target output due to a mistake in the way the invert function is assigning values to the invertedObj.
Copy link

Choose a reason for hiding this comment

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

Alll correct

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