Skip to content

incomplete but better than nothing#21

Open
asakleiman wants to merge 1 commit into
pce-uw-jscript400:masterfrom
asakleiman:master
Open

incomplete but better than nothing#21
asakleiman wants to merge 1 commit into
pce-uw-jscript400:masterfrom
asakleiman:master

Conversation

@asakleiman
Copy link
Copy Markdown

No description provided.

Comment thread app.js
const { vegetables } = data
if (req.query) {
let name = req.query.name
const vegetable = vegetables.find(veggie => veggie.name === name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In this case, we want to be able to find the query string value inside of a name. For example, searching for ?name=pepper should return 'Red Peppers' and 'Green Peppers'. This will only do a direct comparison.

Comment thread app.js
const message = `Could not find vegetable with ID of ${id}`
next({ status: 404, message })
}
data.splice(vegetable, 1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It doesn't look like .splice() is working here. I'm getting the error:

TypeError: data.splice is not a function

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