Fill in the blanks to complete the function that retrieves the year, month and day values and returns the current date in the format "YYYY-MM-DD":
Date
Retrieve individual values
Report a typo
Fill in the gaps with the relevant elements
function getCurrentDate() {
let date = new Date();
let year = ;
let month = + 1; // increase month by 1
let day = ;
return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
}Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.