1

Topic: JS: the Prohibition of change of a variable

There is a class which should be initialized once. How to me to make so at repeated creation of "a class copy" it would not form?
To deliver in the designer if.
And here what to check? const does not go, as he needs to be declared only in a class. To write down created first time object in window? Yes, but after all it can be deleted (window.obj) or to change.
How it is possible to freeze window.obj?

2

Re: JS: the Prohibition of change of a variable

That is necessary for you, is called Singleton Pattern .
Despite an abundance of decisions, an implementation reality on javascript raises the doubts.

3

Re: JS: the Prohibition of change of a variable

Damirovich wrote:

the implementation reality on javascript raises the doubts

Why? Even on the contrary, a flow one.

4

Re: JS: the Prohibition of change of a variable

Tsyklop wrote:

As it is possible to freeze window.obj?

in any way.