loop to store every digit one by one at index j
for ( var i = 0 ; i <= 9 ; i ++ ) { var c = ' ' + i . toString ( ) ; str [ j ] = c ; var Num = parseInt ( str ) ; if ( str [ j ] != s [ j ] && isPrime ( Num ) ) { return false ; } } } return true ; }