//Perfect Square without finding square root function perfectSquare(number) { for (let i = 0; i * i <= number; i++) { if (number % i === 0 && number / i === i) return true; } return false; } let num = 12; console.log(perfectSquare(num));
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter