Notification page

Solution retrospective
I just finished JS on FreeCodeCamp, and because I love project based learning, I had to try this challenge.
But for some reason, my JS code does not respond. Kindly help me check it out
Please log in to post a comment
Log in with GitHubCommunity feedback
- @Cats-n-coffee
Hi!
Nice job for a first Js project! I'll try to point out things that could cause your script to crash:
- if you open your devtools you have an error in the console:
ReferenceError: notifications is not defined
, which means exactly what it says. You'll get used to reading error messages (even if they don't always help it's always a good idea to start there), but this one tells you on line 5 of your script thatnotifications
isn't defined so no value can be read from it. It seems that you forgot to declare yournotifications
variable before using it. - I would also suggest to use a different class to remove on lines 9 and 16 because you are removing the class on the elements you're looping through (looping over the same class). It could potentially create problems (I haven't tried but it's possible) and it also makes it confusing when reading your code. It's okay to add another class to do the read/unread business.
- You're selecting the elements with
notifications
class in 3 different places and you don't need to. If you're having issues with the variable not updating, you could keep track of elements inside of an array, and I'll let you think about this and look it up (let me know if you're stuck). - your mobile view isn't responsive, the layout looks good until 550px but below that everything gets a scroll.
Let me know if you have questions, hope this helps!
- if you open your devtools you have an error in the console:
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord