-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hetav Desai | FrontEnd Project 1 Submission #1
base: main
Are you sure you want to change the base?
Conversation
app.js
Outdated
|
||
function initializeNotes() { | ||
var notesArr = localStorage.getItem(["notes"]); | ||
if (JSON.parse(notesArr) == null || JSON.parse(notesArr).length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of parsing twice, you can parse once and store it in a variable. Also, on first start notesArr
would be undefined, and hence JSON.parse will fail with error, won't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, using variable would be better.
And localStorage.getItem()
returns null if the data we want isn't store in local storage. And hence, on first start, notesArr
will be null and JSON.parse()
will return null as well.
} | ||
|
||
.div-edit { | ||
outline: none; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @desaihetav Great work on this app! I liked it! 👏 Loved using the actual app! ❤️ |
I noticed one commit was messaged "add empty state" n other "added icon buttons".
|
@desaihetav If this code review did help you even a bit become a better developer, I would request you to please retweet/quote this tweet -> https://twitter.com/chinchang457/status/1332706876329365512?s=20 probably asking more people to submit here :) That's all we want...helping more people become better devs :) |
Thank you very much @chinchang for the code review. It was a first time experience getting my code reviewed. Each of your comments is indeed very insightful. Really appreciate the efforts you're putting in!😊 |
No description provided.