Skip to main content
  • Alert
    • Opens a mini window with message
  • Prompt
    • takes input as a string
    • second arg is a default value which will be aleray present in the text field
    •   let a = prompt("Enter value of a ",900); 
      
  • Confirm
    • Asks to confirm and sets true or false
  • We should not use these in UI , use modals Instead
    • extact location and look these are differnet in different browsers
    • These are old methods
    • Blocks the main execution thread , program doesnot continue to next line of code
  •   console.log("hello");
      alert("your script works");
      let a = prompt("Enter value of a ","900");
      a = Number.parseInt(a)
      let write = confirm("Do you want to write it to the page")
      if (write) {
          document.write(a)
    
      } else {
          document.write("please allow me to write")
      }
      alert("you enter datatype of " + (typeof (a)))