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

115
Views
Can someone please assit me with the output of this function
<html>
<script>
function zero ( zeroArray ){
        console.log('ZERO ARRAY ' + zeroArray)
        if(zeroArray !== undefined){
            let fixed = parseInt(zeroArray).toFixed(1)
            console.log('REPLACE '+ fixed.replace(".", ""))
            return fixed.replace(".", "")
        }
        return zeroArray
    }
    </script>
</html>
  • the function appends a 0 when there is an undefined number after the input ie 4 will return 40
  • say the input is 4.4, it needs to return 44 and at the moment it returns 40, or say 3.5 should return 35 which returns 30
  • thanks for any help provided
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

parseInt, rounds it to an integer. Use parseFloat.

Example

parseFloat('10.5').toFixed(1).replace('.','');  // output "105"
about 4 years ago · Juan Pablo Isaza Report

0

function zero(zeroArray) {
    if (zeroArray !== undefined) {
        let fixed = zeroArray * 10;
        return fixed;
    }
}
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!