21 lines
438 B
JavaScript
21 lines
438 B
JavaScript
module.exports.add = (a, b) => a + b;
|
|
module.exports.asyncAdd = (a, b, callback) => {
|
|
setTimeout(() => {
|
|
callback(a + b);
|
|
}, 50);
|
|
}
|
|
|
|
module.exports.square = (x) => x * x;
|
|
module.exports.asyncSquare = (a, callback) => {
|
|
setTimeout(() => {
|
|
callback(a * a);
|
|
}, 50);
|
|
}
|
|
|
|
module.exports.setName = (user, fullName) => {
|
|
var names = fullName.split(" ");
|
|
user.firstName = names[0];
|
|
user.lastName = names[1];
|
|
return user;
|
|
}
|