Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

55
Views
I have a function and I need to know when it will return true and not false

I have this funtion

function riddle (parme) {
  if(parme !== parme) {
    return true;
  }
  return false;
}

when will it return true (I dont know the language)

7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

There is only a single value in JS which is not equal to itself which is NaN. Rest in all cases, it will print false

To check for NaN equality, You should use isNaN

function riddle(parme) {
  if (parme !== parme) {
    return true;
  }
  return false;
}

console.log(riddle(NaN));

7 months 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 job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.