Guest User

Untitled

a guest
Oct 16th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. console.log("I'm Ready!");
  2. var hacker1='Constantinos';
  3. console.log("The driver\'s name is: " +hacker1);
  4. var hacker2 = prompt("What's your navigator\'s name");
  5. console.log("The navigator\'s name is: " +hacker2);
  6. if (hacker1.length>hacker2.length){
  7. console.log("The driver has the longest name, it has "+hacker1.length);
  8. }
  9. else if(hacker1.length<hacker2.length){
  10. console.log("The navigator has the longest name, it has "+hacker2.length);
  11. }
  12. else {
  13. console.log('WOW you both got equally long names'+ hacker2.length);
  14. }
  15. var upname =''
  16. for (var i = 0; i < hacker1.length; i++) {
  17. upname= upname + ' ' + hacker1[i].toUpperCase();
  18. }
  19. console.log(upname);
  20.  
  21. var rev=''
  22. for (var x = hacker2.length - 1 ; x>=0 ; x--) {
  23. rev=rev + hacker2[x];
  24. }
  25. console.log(rev);
Add Comment
Please, Sign In to add comment