javascript 100% 100% simple
\nvar nearestValidPoint = function(x, y, points) {\n    let min = Infinity\n    let idx = -1\n    points.forEach(([a,b], i)=>{\n        if(a===x || b===y){\n   
```\nvar nearestValidPoint = function(x, y, points) {\n    let min = Infinity\n    let idx = -1\n    points.forEach(([a,b], i)=>{\n        if(a===x || b===y){\n            const dist = Math.abs(x-a) + Math.abs(y-b)\n            if(dist<min){\n                idx = i\n                min = dist\n            }\n        }\n    })\n    return idx\n};\n```
['JavaScript']