Link to home
Start Free TrialLog in
Avatar of John S.
John S.Flag for United States of America

asked on

Simple Promise Example Needed

I recently came across this question on an application:

Write a javascript function checkString(foo) which takes a parameter `foo`. The function should return a Promise that resolves if `foo` is equal to "hello", otherwise the Promise should reject. Below this function, write code that invokes checkString() and outputs (in the console) "Good!" upon Promise success or "Bad!" upon Promise failure. Do not use jQuery.

and I was unable to complete this.

Can anyone show me how I would have successfully coded this?

Thank you. I want to be prepared next time.

Regards,

John
ASKER CERTIFIED SOLUTION
Avatar of Swapnil
Swapnil
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John S.

ASKER

Worked perfect. Brilliant, thanks!
Avatar of John S.

ASKER

This solution landed me an interview! ( I will need you to be available on Monday at 9am for emergency answers if they quiz me more ) LMAO