Count of perfect squares of given length | Function to return the count of n digit perfect squares ; Driver code
function countSquares ( n ) { let r = Math . ceil ( Math . sqrt ( Math . pow ( 10 , n ) ) ) ; let l = Math . ceil ( Math . sqrt ( Math . pow ( 10 , n - 1 ) ) ) ; return r - l ; } let n = 3 ; document . write ( countSquares ( n ) ) ;