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

312
Views
Dificultad de Nodejs usando eval dentro de la clase

Tengo problemas para usar eval en mi archivo js (clase).

Cuando desarrollo un código globalmente funciona (Ej 1).

Ahora cuando uso eval dentro de la clase no funciona (Ej 2)

Código Ej 1 ->

 var s = "function teste() {console.log('testando')}" eval(s) this.teste();

**Código Ej 2 -> **

 class Oi { constructor() { this.s = "" this.t = "" } run(){ this.s = "function teste() {console.log('testando')}" eval(this.s) this.teste(); } } let o = new Oi(); o.run();
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Debe llamar a la función en el alcance de la ventana.

 run(){ this.s = "function teste() {console.log('testando')}" eval(this.s) window.teste(); }
about 4 years ago · Santiago Gelvez 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!