Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Go to the project 0 9 - 0 3 . js file in your code editor. Create an if statement that tests whether the object
Go to the projectjs file in your code editor. Create an if statement that tests whether the object localStorage.sbloggerVisit exists. If it does exist, add the commands described in Steps and
Retrieve the value of the sbloggerVisit key from local storage and save the key value to the storedLastDate variable.
Display the value of storedLastDate as the text content of the lastVisitDate object to show the date of the users last visit to the website.
Declare the lastDate variable, storing within it a Date object using the value of the storedLastDate variable.
Create a for of loop that iterates through each item in the articleDates collection. Each time through the loop do the following for every posted article on the website:
Declare the articleDate variable storing within it a Date object containing the date text of the current item in the loop.
If articleDate is greater than lastDate meaning that the article was posted after the users last visit then add "new" to the HTML content of the current item in the articleDates collection.
If localStorage.sbloggerVisit does not exist meaning this is the users first visit to the website then do the following:
Change the text content of the lastVisitDate object to Welcome to SBlogger!
Create a for of loop that iterates through each item in the articleDates collection. Each time through the loop add "new
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started