Advertisement
Guest User

on the bottom of the ocean

a guest
Apr 11th, 2017
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. function main(lines) {
  2. lines=lines.map(Number);
  3. let island=function(x,y) {
  4. switch(true){
  5. case (x>=5&&x<=7&&y>=3&&y<=6):
  6. console.log('Samoa');
  7. break;
  8. case (x>=8&&x<=9&&y>=0&&y<=1):
  9. console.log('Tokelau');
  10. break;
  11. case (x>=1&&x<=3&&y>=1&&y<=3):
  12. console.log('Tuvalu');
  13. break;
  14. case (x>=0&&x<=2&&y>=6&&y<=8):
  15. console.log('Tonga');
  16. break;
  17. case (x>=4&&x<=9&&y>=7&&y<=8):
  18. console.log('Cook');
  19. break;
  20. default:
  21. console.log('On the bottom of the ocean');
  22. break;
  23. }
  24. };
  25. for (let i = 0; i < lines.length; i+=2) {
  26. let x=lines[i];
  27. let y=lines[i+1];
  28. island(x,y);
  29. }
  30. }
  31.  
  32. main(['4', '2', '1.5', '6.5', '1', '3']);
  33. // main(['6','4']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement