ES6 - Complete a Promise with resolve and reject

Hello everyone, i need help with something. What you’re seeing below is my code block, i run it to the console,yet the console ony show curly braces{} as the output.

1- can you tell me what my mistakes are? And thank you very much

const logMyBirthDate = new Promise((resolve,reject) => {
  const myBirthDate = {first: 2005, _$Second: 7, _Last: 27};

   if (myBirthDate.hasOwnProperty(_$Second)) {
  resolve("myBirthDate object possess a property that's called as _$Second");
  } else {
    reject("myBirthDate doesn't possess property a that's called _$Second");


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15

Challenge: ES6 - Complete a Promise with resolve and reject

Link to the challenge:

I’m not 100% sure, as I just completed my ES6 course but I believe you need to look where you’re strings are ending. Remember we can use a plus operator to concatenate parameters (I apologize if that is not the correct syntax) to strings.

This line raises a ReferenceError: _$Second is not defined error because hasOwnProperty accepts a string and is being passed an undefined variable. Try wrapping _$Second in quotes to pass the name as a string instead.

Beyond that, you are logging the promise itself. If you instead want to log the message that is resolved, you can change the last line to:


Same for the rejected message, substituting then for catch.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.