Quantcast
Channel: JetBrains Developer Community : Thread List - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5661

JavaScript Getter and Setter

$
0
0

Hi there,

 

I am trying to figure out how I can add getters and setters using the code generate menu.

 

code:

var myObj = {    config: {        _strict;    },    ... other code ...
}

 

and I need:

var myObj = {    config: {        _strict;    },    ... other code ...    getStrict: function() {        return this.config._strict;    },    setStrict: function(value) {        this.config._strict = value;    }
}

 

 

---

Original message URL: https://devnet.jetbrains.com/message/5538366#5538366

 


Viewing all articles
Browse latest Browse all 5661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>