Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Guessing Game</title>
- </head>
- <body>
- <h1>Welcome to Code 201!</h1>
- </body>
- <script>
- var user = prompt('What is your name?');
- console.log('user: ' + user);
- if( user === '' || user === null){
- alert("Fine, don't play...");
- }
- else
- {
- alert('Greetings, ' + user + '. I have three questions...' );
- var userFrom = prompt( user + ', where do you hail from?');
- console.log('userFrom: ' + userFrom);
- if(userFrom === '' || userFrom === null){
- alert('I\'m sorry you don\'t feel like sharing, ', user );
- }
- else
- {
- alert('Bravo, ' + user + " of " + userFrom + ', you have traversed many domains to get here.');
- var userQuest = prompt( user + ", hailing from " + userFrom + ', what is your quest?');
- console.log('userQuest: ' + userQuest);
- if( userQuest === '' || userQuest === null){
- alert('You have come far in your journey with my questions, but you will not go far in life with out a nobel quest. End of line.');
- }
- else
- {
- if( userQuest === 'I seek the Holy Grail'){
- alert(userQuest + ', tis the nobelest of quests, Sir Galahad!')
- }
- else
- {
- alert(userQuest + ', tis the nobelest of quests! ');
- }
- var favoriteColor = prompt( user + " of " + userFrom + ', what is your favorite color?');
- console.log('favoriteColor: ' + favoriteColor);
- if( favoriteColor === '' || favoriteColor === null ){
- alert('I find you bland and boring, ' + user + ' of ' + userFrom + '. I have grown tired of you. Good day!');
- }
- else
- {
- if( favoriteColor === 'Red! I mean blue!' ){
- alert('Normally I would cry foul, but I accept your answer, Sir Lancelot!' );
- }
- else
- {
- alert('Ahh, ' + user + " of " + userFrom + ', on a quest ' + userQuest + ', I see you have a penchant for ' + favoriteColor + '. Alas, there be but one question left...');
- }
- var velocityAnswer = prompt('What is the airspeed velocity of a swallow?');
- console.log('velocityAnswer: ' + velocityAnswer);
- if( velocityAnswer === '' || velocityAnswer === null){
- alert(user + " of " + userFrom + ', obsessed with ' + favoriteColor + ', on a quest ' + userQuest +', you surely disapoint...')
- }
- else
- {
- if( velocityAnswer === 'African or European?'){
- alert('\"African or European?\" Fine ' + user + " of " + userFrom + ', obsessed with ' + favoriteColor + ', on a quest ' + userQuest +', you are obviously a Monty Python fan!' );
- }
- else
- {
- alert(velocityAnswer + 'was a noble guess, but the this was actually a trick question. The real answer is actually a question');
- alert('African or European?');
- }
- }
- }
- }
- }
- }
- </script>
- </html>
Add Comment
Please, Sign In to add comment