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

183
Views
¿Cómo convertir un número entrecomillado simple o un entero como '265' en un entero real como 265 usando parseInt?

Estoy dando un código como este

Pero obtener la salida como Nan

 var totalTicketOpenCountFromWidget = sunriseReportObj.getIncidentDsrTotalTicketOpenCount(sunriseReportTestData.totalOpenTicketsWidgetName); console.log("totalTicketOpenCountFromWidget :", totalTicketOpenCountFromWidget); var totalTicketOpenCountFromWidgetIntVal = parseInt(totalTicketOpenCountFromWidget);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si tiene la forma de asegurarse de que totalTicketOpenCountFromWidget sea un número que puede hacer:

 totalTicketOpenCountFromWidgetIntVal = parseInt(totalTicketOpenCountFromWidget);

o

 totalTicketOpenCountFromWidgetIntVal = parseInt(totalTicketOpenCountFromWidget, 10);

el 10 apunta a decimal.

Lea más aquí https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt

o la manera más fácil:

 totalTicketOpenCountFromWidgetIntVal = +totalTicketOpenCountFromWidget;

Además, puede envolver su conversión en un bloque try ... catch para manejar la respuesta si totalTicketOpenCountFromWidget no es un número. Lea más aquí https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch

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!