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

157
Views
Error de promesa en node-express, el resultado no se almacena en la matriz

Simplemente, quiero almacenar los resultados en esta matriz y quiero este resultado fuera de la función this.data Quiero pasar estos resultados como this.data y cuando estoy importando esta función uso this.data

 database = admin.database(); class PrivateSingleton { constructor() { let a = []; const keyref = database.ref("data"); const finalfinaldata = keyref.get().then((data) => { const finalData = data.val(); // console.log(finalData) return finalData; }); this.data = finalfinaldata.then(function (result) { // console.log(result); a.push(result); }); console.log(a); this.iv = "IVVV"; this.key = "aaa"; } } class Singleton { constructor() { throw new Error("Use Singleton.getInstance()"); } static getInstance() { if (!Singleton.instance) { Singleton.instance = new PrivateSingleton(); } return Singleton.instance; } } module.exports = Singleton;

PRODUCCIÓN

 : [] // Here I want my result in this array.
about 4 years ago · Juan Pablo Isaza
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!