Solution for Rosetta Code: Date format

A small error in the problem statement has been reported here: https://github.com/freeCodeCamp/freeCodeCamp/issues/39997

What is your hint or solution suggestion?
The full days and months of the year cannot be retrieved from the Date object, so separate arrays have to be created from them.

The first format is an ISO String format, which can be returned using .toISOString() and a separator. Other methods to return various components, for instance, are .getDate() and .getFullYear()

Solution 1
var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];

function getDateFormats() {
  var d = new Date;
  var str = d.toISOString().split('T')[0];

  var day = days[d.getDay()];
  var month = months[d.getMonth()];

  var str1 = day + ", " + month + " " + d.getDate() + ", " + d.getFullYear() 
  console.log([str,str1])
  return [str,str1];
}

Challenge: Date format

Link to the challenge: