Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
Expresión de función (JavaScript)

Convierta la función llamada functionDeclaration en una expresión de función anónima y asígnela a una variable llamada myFunc.

 function functionDeclaration() { let myFunc = str return "Hi there!";

}

 console.log(myFunc())

Soy nuevo en la codificación. ¿Qué estoy haciendo mal? Se supone que debe imprimir '¡Hola!' pero sigue dándome un mensaje de error de referencia.

¡Gracias por tu ayuda!

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

La expresión de tu función podría ser como,

 const func = function functionDeclaration() { return "Hi there!"; } let myFunc = func() console.log(myFunc);
about 4 years ago · Juan Pablo Isaza Report

0

No estoy seguro de cuál es el propósito de let myFunc = str , pero pruébalo:

 function functionDeclaration() { // let myFunc = str return "Hi there!"; } const myFunc = () => { return functionDeclaration.call(this); } console.log(myFunc());
about 4 years ago · Juan Pablo Isaza Report

0

Tu respuesta:

 let myFunc = function() { return "Hi there!"; }

Por favor lea Constructor vs declaración vs expresión

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!