What are JavaScript/jQuery variable names i should avoid creating that could conflict with already existing Global variables. Yesterday i discovered that i cannot use the variable default. It must be a global variable.
What are JavaScript/jQuery variable names i should avoid creating that could conflict with already
Share
defaultis not a global variable: it is a reserved word (it’s used inswitchstatements).You can find a list of reserved keywords on the MDC website.
Note also that there are various other names that you should be careful with. For instance, a variable named
locationcould conflict with thewindow.locationobject unless you’re careful. For this reason (among others), you should avoid global variables.Other such variables are:
window.topwindow.parentwindow.documentwindow.self