title: Making a module that creates a stylesheet
body: <p>I'm trying to add rules to css with js and I came across this line of code. I can't figure out how this return works and how can I possibly rewrite it in my own project.</p>
  
  <pre><code>var sheet = function() {    
      var style = document.createElement('style');
      document.head.appendChild(style);   
      return style.sheet;
  }();
  </code></pre>
  
  <p>Ideally I want to wrap it in some module such as</p>
  
  <pre><code>var AddCssStyles = {
      makeSheet: function(){
          this.stylesheet = document.CreateElement...
          // return a stylesheet for later use
      }
  }
  var navigationHeight = Object.create(AddCssStyles);
  navigationHeight.makeSheet();
  </code></pre>
  
  <p>Which would let me access the sheet with navigationHeight.stylesheet to make the changes.</p>