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

final commit Andre Torres #7

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

Conversation

chicomangusta
Copy link

No description provided.

Comment on lines 131 to +139
console.log('Problem 4:')

// Add your code below this line
const presidentsBetween1850and1900 = president18501900.filter(function(president){
return president.took_office
return president.left_office
})

console.log(presidentsBetween1850and1900)
Copy link

Choose a reason for hiding this comment

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

@chicomangusta Good attempt at this solution. One suggestion because you are using the filter and the variable president18501900 this will return an error since president18501900 variable is undefined.
You can replace president18501900 with presidents

Take a look at this alternate approach here

Comment on lines +108 to +112
const presidentialParties = presParties.filter(function(presParty){
return presParty.party
})
console.log(presidentialParties)

Copy link

Choose a reason for hiding this comment

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

@chicomangusta Good job here on this assignment. I see you're using the filter method to return the president party.

  • currently, you are usingpresParties to run a filter on but the variable presParties is undefined so that would throw an error. if you change the presParties to presidents your solution should work.
  • Also, the map method would've been a good option for this use case as map would've returned all of the parties for you in a new array.

Take a look at this approach here

Comment on lines +75 to +80
const presidentsNamedJames = presidents.find(funsction (president){
return president.president.split("")[0] === "James"
})

console.log(presidentsNamedJames)

Copy link

@Tech-J Tech-J Oct 14, 2019

Choose a reason for hiding this comment

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

@chicomangusta Good start to this assignment here. I have a few suggestions for you
-make sure you correct the spelling for the keyword function

  • For this example, instead of using find that will return only the first president with the name James you can use the filter method.
  • Also for the president split currently when you don't include a space in your split method, ex. president.president.split("")[0] it will split every single letter in the string. you would want to add a space president.president.split(" ")[0].

Take a look at this solution here

Comment on lines +46 to +51
const firstWhigPresident = presidents.find(function (president) {
return president.party === "Whig"
})

console.log(firstWhigPresident.party)

Copy link

Choose a reason for hiding this comment

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

@chicomangusta Good job here using the find method to return the first president who belongs to the Whig party. One suggestion when you console.log(firstWhigPresident.party) you can leave off the .party and just console.log(firstWhigPresident)

Take a look at this solution here

Comment on lines 159 to +166
console.log('Problem 5:')

// Add your code below this line
const livingPresidents = presidents.filter(function(president){
return president.left_office === 'null'
})

console.log(livingPresidents)
Copy link

Choose a reason for hiding this comment

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

@chicomangusta Good job on this solution here using the filter method to return all of the presidents who are currently living.

Take a look at this approach here

Comment on lines 214 to +222
console.log('Problem 7:')

// Add your code below this line

const shortTermPresidents = presidents.filter(function(president){
return president.took_office
return president.left_office
})
console.log(shortTermPresidents)
console.log(left_office -= took_office)
Copy link

Choose a reason for hiding this comment

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

@chicomangusta Good attempt here at this solution to use this filter method to return the presidents who served for less than 4 years. You needed to do a little more inside your filter method. The solution below will help give you some further insight.

Take a look at this alternate solution here

Comment on lines 186 to +194
console.log('Problem 6:')

// Add your code below this line
console.log(presidentsParties [0])
const firstRepublican = presidentsParties.find(function(presidentParty){
return presidentParty.party === 'Republican'
})

console.log(firstRepublican)
Copy link

Choose a reason for hiding this comment

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

@chicomangusta Good job here reusing the variable presidentsParties to return the first occurrence of the republican party.

Take a look at this solution here

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

Successfully merging this pull request may close these issues.

3 participants