create a global array of size 10001 ; initialize all entries of it as true . A value in mark [ p ] will finally be false if ' p ' is Not a prime , else true .
let arr = Array ( 1001 ) . fill ( true ) ;