Anonymous Functions - Right solutions doesn't pass the test

Hi, I’m doing “ES6” module, " Use Arrow Functions to Write Concise Anonymous Functions" exercise.
After write two correct answers, neither of them pass the test (these are the “hints” answers).
I try with Chrome and Edge getting same results.
Could you please help me? I can’t go on with ES6 module

  **Your code so far**

Use Arrow Functions to Write Concise Anonymous Functions
In JavaScript, we often don't need to name our functions, especially when passing a function as an argument to another function. Instead, we create inline functions. We don't need to name these functions because we do not reuse them anywhere else.

To achieve this, we often use the following syntax:

const myFunc = function() {
const myVar = "value";
return myVar;
ES6 provides us with the syntactic sugar to not have to write anonymous functions this way. Instead, you can use arrow function syntax:

const myFunc = () => {
const myVar = "value";
return myVar;
When there is no function body, and only a return value, arrow function syntax allows you to omit the keyword return as well as the brackets surrounding the code. This helps simplify smaller functions into one-line statements:

const myFunc = () => "value";
This code will still return the string value by default.

Rewrite the function assigned to the variable magic which returns a new Date() to use arrow function syntax. Also, make sure nothing is defined using the keyword var.

// Solución 1
// ----------
const magic = () => {
return new Date();

//var magic = function() {
//  return new Date();

// Solución 2
// ----------
//const magic = () => new Date();

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36

Challenge: Use Arrow Functions to Write Concise Anonymous Functions

Link to the challenge:

Hi @jfrb !

Welcome to the forum!

The issue has to deal with all of the comments you added.

I would remove all of those and just submit the answer.

Hope that helps!

Hi jwilkins.oboe

I’ve just delete all the commets and exercise pass the test fine.
Sorry for take your time
Thanks a lot!!!

1 Like

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