Date function bug? (ES6 section question)

On this challenge, we need to utilize the Date function in an Arrow Function. Now, I successfully get my date/time returned when calling back through console.log, but the error says ‘magic() should return correct date’? Even though it is? I’m fairly sure my answer is correct (have not looked at solution yet) though I’d really appreciate some feedback as to perhaps the one-liner that I think is the solution is wrong?

Your code so far


const magic = () => Date();

Doesn’t look like answer should be one line of code… coding is weird and confusing…

I’m guessing because new date (within the function they show you to use in the solution) returns the latest date to whatever code/engine confirms whether your code is correct or not. Actually, I’m fairly certain that’s why. Feel free to add comments/opinions. Have a good day all.

it’s difficult to know what you are talking about without some context. What’s the link to this challenge?

Could’ve sworn I had added the link. Anyways, ^

Hello there,

The instructions are:

…which returns a new Date()

You have:

const magic = () => Date();

The main difference being:

  • Date() returns a string
  • new Date() returns a date object

Hope this clarifies.