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

91
Views
Function returns Nan returns when I send More argument then function parameters

I couldn't understand why it send the nan when I pass more arguments than parameters

function percetageofworld3(population1) {
    return (population1 / 7900) * 100;
}
const describePopulation = function(country, population) {
    const chinesePopulation = percetageofworld3(country, population);
    console.log(chinesePopulation)
    const countries = `${country} has ${population} million people,
        which is about ${chinesePopulation}% of the world`
    return countries;
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You pass into percetageofworld3 two parameter but the function have just one, so you pass country for example 'italy' and it will be return ('italy' / 7900) * 100;

If you pass only number work

function percetageofworld3(population1) {
  return (population1 / 7900) * 100;
}
const describePopulation = function(country, population) {
  const chinesePopulation = percetageofworld3(population);
  console.log('Result of chinesePopulation: ' + chinesePopulation)
  const countries = `${country} has ${population} million people,
which is about ${chinesePopulation}% of the world`
  return countries;
}
console.log('Result of describePopulation: ' + describePopulation('italy', 1000))

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!