ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 102 - Certified JavaScript Developer I discussion

Report
Export

A developer is wondering whether to use, Promise.then or Promise.catch, especially when a Promise throws an error?

Which two promises are rejected?

Which 2 are correct?

A.
Promise.reject('cool error here').then(error => console.error(error));
Answers
A.
Promise.reject('cool error here').then(error => console.error(error));
B.
Promise.reject('cool error here').catch(error => console.error(error));
Answers
B.
Promise.reject('cool error here').catch(error => console.error(error));
C.
New Promise((resolve, reject) => (throw 'cool error here'}).catch(error => console.error(error)) ;
Answers
C.
New Promise((resolve, reject) => (throw 'cool error here'}).catch(error => console.error(error)) ;
D.
New Promise(() => (throw 'cool error here'}).then(null, error => console.error(error)));
Answers
D.
New Promise(() => (throw 'cool error here'}).then(null, error => console.error(error)));
Suggested answer: B, C
asked 23/09/2024
Jasper John Cecilio
30 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first