Thanks for the help. What about a situation where an application has multiple js plugins and you’re creating a plugin of your own? In this case, I want to check if up until this point any library has created a global variable (object, array, etc) with, let’s say, ‘globalVar’.
Is there any particular reason why your global object needs a name? If you are not going to reference it from anywhere else then you could use an anonymous global object which therefore wouldn’t clash with any other object because it doesn’t have a name to clash with.