saginadir
2/17/2017 - 6:16 PM

myBetterFunction.js

const capitalize = (string) => 
  string.charAt(0).toUpperCase().concat(string.slice(1));

const saveToDb = (db, entity) => 
  () => 
    db.save(entity);

const html = (selector, newHtml) =>
  () =>
    $(selector).html(newHtml);

const executeAll = ()

function updateUserNameSaveToDb(user, newName, db) {
  const newUser = {...user, name: capitalize(newName)}
  const saveNewUserToDb = saveToDb(db, newUser);
  const changeUserGreeting = html('.user-greet', `hello ${newUser.name}`)
}