Guest User

Untitled

a guest
Apr 13th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. 1. Prepare and show message in console.
  2. - Create variables for person name, time, place and event
  3. - Event should be entered using prompt
  4. // tip: var smth = prompt("Please enter value", "Default value");
  5. - Other variables should be set as you wish
  6. - Join all values to one sentence and show it in console
  7. // example: Valera has a meeting today at 17:00 somewhere in Warsaw.
  8.  
  9.  
  10. 2. Find and show (using alert) distance between 2 points.
  11. - Create variables for x1, y1, x2, y2, result
  12. - Coordinates of second point (X2, Y2) should be entered using prompt
  13. - Other variables should be set as you wish
  14. - Find distance, set it to result variable
  15. - Alert the result with description
  16. // example: The distance between points A(0,1) and B(0,11) is 10.
  17.  
  18. 3. Show in console using FOR.
  19. #
  20. ##
  21. ###
  22. ####
  23. #####
  24. ######
  25. #######
  26. ########
  27. #########
  28. ##########
  29.  
  30. 4. Show in console using WHILE.
  31. # # # # #
  32. # # # # #
  33. # # # # #
  34. # # # # #
  35. # # # # #
  36. # # # # #
  37. # # # # #
  38.  
  39.  
  40. 5. Create “Guess number” game.
  41. - Create variable for random number (from 0 to 100) and set it using Math.random()
  42. // tip: Math.random() returns number from 0 to 1, so you have to
  43. // multiply it by 100 and then convert result to integer.
  44. - Ask user (with prompt) to guess the number
  45. - If entered number doesn’t equal to our variable, alert “Our number is higher, try again” or “Our number is lower, try again”. Then ask user to enter number again.
  46. - If user guessed the number, show message “You are right, the number is [number]”.
Advertisement
Add Comment
Please, Sign In to add comment