Introduction
In this lab, we will dive into JavaScript programming and create a function called daysAgo
. This function takes a number as input and calculates the date that is n
days ago from today. We will use the Date
constructor, along with various methods such as Math.abs()
and Date.prototype.setDate()
, to accomplish this task and return the result as a string in yyyy-mm-dd
format. By the end of this lab, you will have gained a deeper understanding of working with dates in JavaScript.