Skip to content

Commit

Permalink
write manhattan distance with javascript BaReinhard#240
Browse files Browse the repository at this point in the history
  • Loading branch information
mgilangjanuar committed Oct 19, 2017
1 parent 8c8d09c commit fcf58a1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions geometry/manhattan_distance/javascript/ManhattanDistance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function manhattanDistance(x1, y1, x2, y2) {
return Math.abs(x1 - x2) + Math.abs(y1 - y2);
}

console.log(manhattanDistance(1, 2, 2, 3));

0 comments on commit fcf58a1

Please sign in to comment.