Hi

Is there a way that I can define read-only variable (Boolean, String, ...) in Javascript class? (I really don't want to use GET and SET method, basically defining them in Constructor, as every instance of my class wouldn't have the same SET and GET method) Maybe this would be an easier question, Navigator class has some read-only properties such as appName, ..., How did they do that?


Thanks in advance.


--
Mark

Recommended Answers

have a look at const if it satisfies your requirements

Jump to Post

All 2 Replies

have a look at const if it satisfies your requirements

anilashanbhag thanks for your reply.
No const won't work as I have to change the value of those variables inside the class.


--
Mark

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.