This article mainly shares with you an interview question about javascript two-dimensional arrays. I hope it can help you. Given a two-dimensional array, implement a functional function fn and pass a coordinate of the two-dimensional array to this function. If the value of this coordinate is "1", all coordinates connected to this coordinate and whose coordinate value is 1 will be returned. .
For example, passing fn([3,4]) results in:
[[3,4],[4,4],[5,4],[6,4] ,[7,4],[8,4],[8,5],[8,6]]
var arr =[ [0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,1,0,0,0,1,0,0], [0,0,0,0,1,0,0,0,1,0,0], [0,0,0,0,1,0,0,0,1,0,0], [0,0,0,0,1,0,0,0,0,0,0], [0,0,0,0,1,0,0,0,0,0,0], [0,0,0,0,1,1,1,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0], ] ;