Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
So there is a call to loadFaves, and now let's put in that code itself. I'll make a little extra room there, so we can see what's happening. So it's function loadFaves curly brace pair. Now the first thing we want to make sure is that the function that we're trying to load exists. So we'll use an if statement, if (localStorage.get item) and then another curly brace and then another set of parentheses and quotes, and we want to check to see if the items favorites is the one that exists.
So if that exists--and let's put in another curly brace pair here--then what we want to do is get it and then assign what we get to the inner HTML of the unordered list, which we know as the variable the faves. So, it's theFaves.innerHTML = localStorage.getItem, and in parentheses, favorites, semicolon at the end and save, and that's it.
Let's check our work in the browser. I'll refresh the page. Now, let's scroll down, and let's say this time we want the eye, the $400, one of our favorites. It shows up in our list. And let's bring in rabbit as well. Okay, so I'm going to just copy this URL, and open up a new tab, paste it in, and hit Refresh, and then when I scroll down, there are my favorites. Well, congrats! Your ecommerce catalog is now greatly enhanced and totally engaging, with three interwoven HTML5-related technologies.
I'm sure your users will appreciate the upgrade to their experience.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.