https://www.w3schools.com/js/js_object_accessors.asp
On this page it is shown that a object can implement get and setters in javascript. But they use a different way to create an object than my code. How can i implement get and setters in the following code:
function Settings()
{
var fullscreen;
// get function
this.fullScreen = function ()
{
if(fullscreen === undefined)
{
return false
}
return fullscreen;
};
// set function
this.fullScreen = function (fullscrn)
{
fullscreen = fullscrn;
};
// I want to call the set like this: settingsobj.fullScreen = false;
// I want to call the get like this: var myvar = settingsobj.fullScreen;
}