title: Can anyone tell me how this javaScript function works please?
body: <p>I am a beginner and recently I have stumbled onto this. I do not understand what this <code>d.getDays()</code> does. Please help me out.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const dateBuilder = (d) =&gt; {
    let months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
    let days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
  
    let day = days[d.getDay()];
    let date = d.getDate();
    let month = months[d.getMonth()];
    let year = d.getFullYear();
  
    return `${day} ${date} ${month} ${year}`
  }
  console.log(dateBuilder(new Date()));</code></pre>
  </div>
  </div>
  </p>