Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <h2>JavaScript Prompt</h2>
- <button onclick="myFunction()">Try it</button>
- <p id="demo"></p>
- <script>
- function myFunction(){
- var preference = prompt("Do you like potatoes?");
- if (preference == "yes") {
- for(var i=1; i<=7; i++){
- var potatoes = "#";
- console.log(potatoes.repeat(i))
- }
- } else if(preference == "no"){
- alert("You are a disgrace")
- } else {
- alert("I didn't understand.")
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement