Gistlib Logo

gistlib

find the nth square number in javascript

index.tsx
function nthSquareNumber(n) {
  return Math.pow(n, 2);
}

// example usage
nthSquareNumber(5); // returns 25
109 chars
7 lines

similar javascript code snippets

find the nth square number in javascript
define a function that takes a list of numbers as an argument and returns the sum of the numbers in the list. in javascript
calculate pi plus infinity in javascript
create a function that takes in 3 arguments in javascript
print the numbers from 1 to 100 in javascript
print the numbers from 1 to 100, but only print the even numbers in javascript
calculate pi in javascript
build a list of the numbers from 1 to 100 in javascript
find the largest number in the following list of numbers: [1, 3, 4, 2, 5] in javascript
find it a number is odd in javascript

related categories

javascript
math
square
number
nth

gistlibby LogSnag