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

112
Views
Reaccionar nativo, no puede convertir el resultado de la función en número

Necesito convertir el resultado de esta función a número:

 const [nbChambres, setNbChambres] = useState(1); const [nbNuits, setNbNuits] = useState(1); function calculatePrixTotal(){ const nbChambresInt = parseInt(nbChambres) || 1; const nbNuitsInt = parseInt(nbNuits) || 1; let priceNumber = price.substring(1); if(priceNumber.includes(',')) { priceNumber = parseInt(priceNumber.replace(',', '')); const prixTotal = String(priceNumber * nbNuitsInt * nbChambresInt); return prixTotal.slice(0, prixTotal.length - 3) + "," + prixTotal.slice(prixTotal.length - 3); } else { return String(parseInt(priceNumber) * nbNuitsInt * nbChambresInt); } }

Aquí está la función que hice para hacer la resta, obtuve NaN como resultado:

 function calculateNewMoneyBalance(){ const calcInt = parseFloat(calculatePrixTotal); const moneyInt = parseInt(MoneyBalance); console.log(typeof moneyInt); return parseInt(moneyInt - calcInt); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Hola, agrega un método para llamar a la función.

let calcInt= parseFloat(calculatePrixTotal())

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!