georgiev955

8

Sep 17th, 2023
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. function validityChecker(x1, y1, x2, y2) {
  2. if (Number.isInteger(Math.sqrt((0 - x1) * (0 - x1) + (0 - y1) * (0 - y1)))) {
  3. console.log(`{${x1}, ${y1}} to {0, 0} is valid`);
  4. } else {
  5. console.log(`{${x1 }, ${y1}} to {0, 0} is invalid`);
  6. }
  7.  
  8. if (Number.isInteger(Math.sqrt((0 - x2) * (0 - x2) + (0 - y2) * (0 - y2)))) {
  9. console.log(`{${x2}, ${y2}} to {0, 0} is valid`);
  10. } else {
  11. console.log(`{${x2}, ${y2}} to {0, 0} is invalid`);
  12. }
  13.  
  14. if (Number.isInteger(Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)))) {
  15. console.log(`{${x1}, ${y1}} to {${x2}, ${y2}} is valid`);
  16. } else {
  17. console.log(`{${x1}, ${y1}} to {${x2}, ${y2}} is invalid`);
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment