Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Ex1
  • Loading branch information
massam89 committed Dec 19, 2020
commit 7bf4869b660916d1ab922d4baa95f23a4f9adae0
17 changes: 17 additions & 0 deletions Week2/homework/masoud/js-exercises/Ex1-johnWho.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function getAnonName(firstName) {
return new Promise((resolves, rejects) => {
if (firstName) {
resolves(`${firstName} Doe`);
} else {
rejects(new Error("You didn't pass in a first name!"));
}
})
};

const firstName = 'Masoud';
getAnonName(firstName).then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
})
Empty file.
Empty file.