0
if (name === "billy") {
  alert("Hi Billy");
}

UncaughtType Error: alert is not a function at :2:2

Tyler Roper
  • 21,445
  • 6
  • 33
  • 56
One Mad Nomad
  • 11
  • 1
  • 1
  • 3
    Perhaps you have inadvertently overriden `alert` elsewhere in your code, due to something like `alert = "Hello World"`? Some pop-up blockers do this intentionally as a method of disabling alerts. Regardless, the code you've provided *does not recreate the issue*, therefore we can only blindly guess. – Tyler Roper Jan 06 '19 at 04:59
  • 4
    Take a look at https://stackoverflow.com/a/17833703/753237 – ic3b3rg Jan 06 '19 at 05:00
  • 1
    Possible duplicate of [Error on using alert in Javascript (Property 'alert' of object is not a function)](https://stackoverflow.com/questions/11334581/error-on-using-alert-in-javascript-property-alert-of-object-is-not-a-function) – Mohammad Usman Jan 06 '19 at 05:45
  • I think @Tyler Roper is right, I had a similar error, after reading his comment, it turns out I am passing alert as props from another component, this was as a result of a bad naming convention though. but his comment saved me – Solomon Sunday Feb 04 '22 at 23:08

0 Answers0