According to this MDN article and any other source I can find, "alert" and "confirm" are not reserved words in JavaScript. Why are they not listed here, and are they safe to use as variable names inside of function bodies?
They are safe to use inside function bodies as long as you declare them with var
. If you don't declare them with var, then you would overwrite them in the global (window) scope, which could cause a lot of issues.