Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Ivy js2 wk2 #20

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

chichiglacierz
Copy link

No description provided.

Copy link

@grod220 grod220 left a comment

Choose a reason for hiding this comment

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

Try not to commit .DS_Store. You may want to add this to your .gitignore file.

Some things are missing:
step2-3.js
step2-4.js
step2-5.js
step2-7.js
step3.js

const salaryPerDay = timeInHours.map(hoursPerDay => hoursPerDay * hourlyRate);
const totalSalary = salaryPerDay.reduce((sum, dailySalary) => sum + dailySalary, 0);
const euroSalary = totalSalary.toFixed(2);
return euroSalary;
Copy link

Choose a reason for hiding this comment

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

Nice and clear code 👍

if (i % 3 === 0) {
threeCallback[i];
} else if (i % 5 === 0) {
fiveCallback[i];
Copy link

Choose a reason for hiding this comment

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

Not quite there. You need to call the function. So instead of
fiveCallback[i];
You'd do
fiveCallback(i)

Copy link

Choose a reason for hiding this comment

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

Please fix

@@ -11,4 +11,6 @@ console.log(addSix(10)); // returns 16
console.log(addSix(21)); // returns 27

// Do not change or remove anything below this line
Copy link

Choose a reason for hiding this comment

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

Above, you'll need to add code to make createBase function work

@@ -4,7 +4,9 @@ const values = ['a', 'b', 'c', 'd', 'a', 'e', 'f', 'c'];

function makeUnique(arr) {
// Replace this comment and the next line with your code
console.log(arr);
arr = new Set(arr);
Copy link

Choose a reason for hiding this comment

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

Nice technique using Set data structure 👍


// In the second function, the value of y is an object containing a key and a value.
// when the object is passed in the function, one is added to the value of the object itself
// and the value of the value increases by 1 and we get {x: 10}
Copy link

Choose a reason for hiding this comment

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

I think you get it (?). Another example:

let a = 4
let b = a
a += 1
What's the value of b?

vs objects...

let a = { name: 'gabe' }
b = a
a.country = 'us'
what's the value of b?

Do you see the difference?

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

Successfully merging this pull request may close these issues.

2 participants