dabidabidesh

validityChecker

Sep 17th, 2020
324
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. validityChecker1 = arr => {
  2.   'use-strict'
  3.  
  4.   const printDistance = (x1, y1, x2, y2) => {
  5.     let distance = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
  6.     console.log(`{${x1}, ${y1}} to {${x2}, ${y2}} is ${Number.isInteger(distance) ? 'valid' : 'invalid'}`)
  7.   }
  8.  
  9.   printDistance(arr[0], arr[1], 0, 0)
  10.   printDistance(arr[2], arr[3], 0, 0)
  11.   printDistance(arr[0], arr[1], arr[2], arr[3])
  12. }
RAW Paste Data