Match it with switch case
switch ( r ) { case 1 : document . write ( " " ) ; break ; case 2 : document . write ( " " ) ; break ; case 3 : document . write ( " " ) ; break ; case 4 : document . write ( " " ) ; break ; case 5 : document . write ( " " ) ; break ; case 6 : document . write ( " " ) ; break ; case 7 : document . write ( " " ) ; break ; case 8 : document . write ( " " ) ; break ; case 9 : document . write ( " " ) ; break ; case 0 : document . write ( " " ) ; break ; default : document . write ( " " ) ; break ; }