title: How to use get and set functions javascript object
body: <p><a href="https://www.w3schools.com/js/js_object_accessors.asp" rel="nofollow noreferrer">https://www.w3schools.com/js/js_object_accessors.asp</a></p>
  
  <p>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:</p>
  
  <pre><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;
  }
  </code></pre>