Advertisement
Guest User

Untitled

a guest
Feb 15th, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. let choiceObj = {
  2. doChoice: function(text){
  3. text = text;
  4. let choice = prompt(text);
  5. return this.choice;
  6. }, // передаю текст в prompt, и возвращаю то что ввел туда пользователь
  7. choiceUp: function (){
  8. if (this.choice) {
  9. console.log('good');
  10. return true;
  11. } else {
  12. console.log("false");
  13. return false;
  14. }
  15. } // Отдельно! возвращаю true или false в зависимости как пользователь отреагировал на prompt.
  16. }
  17.  
  18. choiceObj
  19. .doChoice("some text here")
  20. .choiceUp();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement