Advertisement
nikolayneykov

Untitled

Apr 30th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve ([x1, y1, x2, y2]) {
  2.   function printResult (x1, y1, x2, y2) {
  3.     let isValid = Number.isInteger(Math.hypot(x1 - x2, y1 - y2))
  4.       ? 'valid'
  5.       : 'invalid'
  6.     console.log(`{${x1}, ${y1}} to {${x2}, ${y2}} is ${isValid}`)
  7.   }
  8.  
  9.   printResult(x1, y1, 0, 0)
  10.   printResult(x2, y2, 0, 0)
  11.   printResult(x1, y1, x2, y2)
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement