Javascript program to return previous element in an expanding matrix
String . prototype . replaceAt = function ( index , replacement ) { return this . substr ( 0 , index ) + replacement + this . substr ( index + replacement . length ) ; }