Skip to content

First Submission - all initial challenges completed not including stretch tasks#432

Open
gittc100 wants to merge 3 commits intobloominstituteoftechnology:masterfrom
gittc100:master
Open

First Submission - all initial challenges completed not including stretch tasks#432
gittc100 wants to merge 3 commits intobloominstituteoftechnology:masterfrom
gittc100:master

Conversation

@gittc100
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@johnoro johnoro left a comment

Choose a reason for hiding this comment

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

Awesome work!

console.log(kennan["id"]);
console.log(keven["email"]);
console.log(gannie["name"]);
console.log(antonietta['gender']);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Keep in mind that bracket notation isn't necessary here; you could've used dot notation like this:

console.log(keven.email);

}
for(let i = 0; i < carYears.length; i++){
console.log(carYears[i]);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could log the cars as you push them here (so that you don't have to loop twice):

for(let i = 0; i < inventory.length; i++){
    carYears.push(inventory[i]["car_year"]);
    console.log(carYears[i]);
}

console.log();
for(let i = 0; i < carYears.length; i++){
if(carYears[i] < 2000){
oldCars.push(carYears);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This isn't pushing the car years! It's instead pushing the whole carYears array multiple times, so the length still adds up. Use carYears[i].

exampleArray = [1,2,3,4];
const triple = exampleArray.map((num) => {
return num * 3;
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since you only have a single statement/expression that you're returning in your map callback, you could shorten it (by loosing the braces and the return keyword):

    const triple = exampleArray.map((num) => num * 3);

You can also lose the parentheses if you only have a single parameter (and you're not doing anything fancy with it):

    const triple = exampleArray.map(num => num * 3);

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