I’m still new here, so I hope my ‘noob-view’ will help others like me out. 
first off, notice this on line 7 in app.js
const { getElementById, getIndexById, updateElement,
seedElements, createElement } = require(‘./utils’); // this is where you’re importing the ‘updateElement’ helper function
then break down the provided text into bite-size chunks.
Use req.query to update the proper element in the expressions array.
use the updateElement helper function.
It takes three arguments
- id (id number of element)
- queryArguments (new, updated expressions object from req.query)
- elementList (array which contains the element to update.)
returns updated element
Which means it will look like this:
updateElement(id, query, elementList)
//which, in the function we’re using, becomes:
updateElement(req.params.id, req.query, expressions)
Explaining the solution
app.put(‘/expressions/:id’, (req, res, next) => { //whenever a PUT-request is sent to the server with the following path: '/expressions/:id, start the following function
const expressionIndex = getIndexById(req.params.id, expressions); //getIndexById takes the id as first parameter, filename as second. the index is now assigned to ‘expressionIndex’.
with this we can check, in the code below, if the requested id exists.
if (expressionIndex !== -1) { //if expressionIndex DOES NOT equal -1, it means an index has been found, proceed with next two lines of code
updateElement(req.params.id, req.query, expressions); //now update the element
res.send(expressions[expressionIndex]);//in server response, send back the updated element
} else {
res.status(404).send(); //send 404 if expressionIndex was -1
}
});
Hope this helps!
Send me a message if you want me to change the formatting or have questions 