resolveWithValue() practice question!

Hello! Can anyone help solve this quiz question? I have been stuck for two days now!

Write a function resolveWithValue() that has two parameters:

  • The first parameter is a function that returns a promise.
  • The second parameter is a string value.

When called, resolveWithValue() should invoke the function argument with the string argument and then log the resultant promise’s resolve value or reject reason to the console.

They provide this code:

let testerFunc = (str) => {
if (Math.random() < .5){
return Promise.resolve(Resolved with: ${str})
} else {
return Promise.reject(Rejected with: ${str})


Provided link: