Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CALLBACKS

DOM Tree

JavaScript

Callbacks are functions than are invoked as argument to manipulate or propagate the result of an internal operation.

function createUser(fullName) {
  const timestamp = Date.now();
  const userId = `${Math.floor(Math.random() * 100)}-${timestamp}`;

  return {
    id: userId,
    user: fullName,
    createdAt: timestamp,
  };
}

function processUserEntry(name, surname, callback) {
  if (!name || !surname) return {};

  const fullName = `${name} ${surname}`;
  const newUser = callback(fullName);

  return newUser;
}

processUserEntry("Ada", "Lovelace", createUser);

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages