Driver code
let arr = [ " " , " " , " " , " " , " " , " " , " " , " " , " " , " " , " " , " " ] ; let x = " " ; let n = x . length ; let index = sparseSearch ( arr , x , n ) ; if ( index != - 1 ) document . write ( x + " " + index ) ; else document . write ( x + " " ) ;