 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Pronic numbers in JavaScript
A Pronic number is a number which is the product of two consecutive integers, that is, a number of the form n(n + 1).
We are required to write a JavaScript function that takes in a number and returns true if it is a Pronic number otherwise returns false
Let’s write the code for this function −
Example
const num = 90; const isPronic = num => {    let nearestSqrt = Math.floor(Math.sqrt(num)) - 1;    while(nearestSqrt * (nearestSqrt + 1) <= num){       if(nearestSqrt * (nearestSqrt+1) === num ){          return true;       };       nearestSqrt++;    };    return false; }; console.log(isPronic(num));  Output
Following is the output in the console −
true
Advertisements
 