Update app.js

added variable and changed both functions to one line.