
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
Check for perfect square in JavaScript
We are required to write a JavaScript function that takes in a number and returns a boolean based on the fact whether or not the number is a perfect square.
Examples of perfect square numbers −
Some perfect square numbers are −
144, 196, 121, 81, 484
Example
The code for this will be −
const num = 484; const isPerfectSquare = num => { let ind = 1; while(ind * ind <= num){ if(ind * ind !== num){ ind++; continue; }; return true; }; return false; }; console.log(isPerfectSquare(num));
Output
The output in the console −
true
- Related Articles
- Check for perfect square without using Math libraries - JavaScript
- Check Perfect Square or Not
- Check if given number is perfect square in Python
- Check if a number is perfect square without finding square root in C++
- Check if a number in a list is perfect square using Python
- Integers have sum of squared divisors as perfect square in JavaScript
- Check if product of array containing prime numbers is a perfect square in Python
- Check whether the number can be made perfect square after adding 1 in Python
- Program to check number is perfect square or not without sqrt function in Python
- Is 9075 a perfect square?
- What is a perfect square?
- How to find perfect square root?
- Check whether the number formed by concatenating two numbers is a perfect square or not in Python
- Count numbers upto N which are both perfect square and perfect cube in C++
- Building an array of specific size with consecutive element sum being perfect square in JavaScript

Advertisements