That is happening because you're using the var keyword for variable declaration, a property created with var is non-configurable, therefore they can't be deleted from the object they are being assigned to, in this case window, if you choose to use const/let such thing does not happen directly, which could represent a better alternative since they are block-scoped.