Daily Coding Challenge - Pi Day

Tell us what’s happening:

The major problem is getting my PI to have a 1000 decimal places or digits its not an integer so BigInt() does not apply, someone please guide me!

function getPiDecimal(n) {
let pi = Math.PI.toString();
return Number(pi[n + 1]);
}

console.log(getPiDecimal(999))

Your code so far

function getPiDecimal(n) {
 let pi = Math.PI.toString();
  return Number(pi[n + 1]);
}

console.log(getPiDecimal(3))

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:148.0) Gecko/20100101 Firefox/148.0

Challenge Information:

Daily Coding Challenge - Pi Day

https://www.freecodecamp.org/learn/daily-coding-challenge/2026-03-14

you can follow the hint in the instructions

You may have to find the first 1000 decimals of π somewhere.

if Math.PI does not have enough digits, find them somewhere else

1 Like