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

ObjectsLab #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

ObjectsLab #105

wants to merge 1 commit into from

Conversation

dannellmorales
Copy link

Incomplete as I did what I could with help of Obi

const appleCount = () => {};

const appleCount = (appleCountByName, name) => {
if(!appleCountByName[name]){
Copy link
Contributor

Choose a reason for hiding this comment

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

can we do:
return appleCountByName[name] || 0

How does this work?

const adamAndEveApples = () => {};
// let names = {"Adam": 2, "Eve": 5}
const adamAndEveApples = (appleCountByName) => {
let sum = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this sum variable. Too much work and not helping us. Just return appleCountByName.Adam + appleCountByName.Eve

const appleSum = () => {};
const appleSum = (appleCountByName, number) => {
let sum = 0
sum = appleCountByName
Copy link
Contributor

Choose a reason for hiding this comment

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

appleCountByName is an object. Make sure you think about things in terms of types of data.

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