Review fixes#6
Open
haimre wants to merge 13 commits into
Open
Conversation
… alerts, accessive indentaions removed
ofirdagan
requested changes
Feb 7, 2022
| let editMode = false; | ||
|
|
||
| function getNewID(){ | ||
| return Math.floor(Math.random()*1000) |
Owner
There was a problem hiding this comment.
not good enough. the probability of getting the same id is 1/1000 which is pretty high. why didn't u take the guid generation function?
function uuidv4() {
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
}
| return Math.floor(Math.random()*1000) | ||
| } | ||
| function addItem(){ | ||
| let title = document.getElementById('title-input').value |
Owner
There was a problem hiding this comment.
the default should be always const unless your'e going to change either the pointer or if it's a primitive its value.
change all let to const unless u have to use let
| let itemElement = createTodoItemElement(id,title,content) | ||
|
|
||
| list.appendChild(itemElement) | ||
| // now save to local storage |
|
|
||
| list.appendChild(itemElement) | ||
| // now save to local storage | ||
| let itemString = `title: ${title};content: ${content}` |
Owner
There was a problem hiding this comment.
line 24+25 should be in its own function
|
|
||
| // reset menu display | ||
| clearMenu() | ||
| document.getElementById('menu-button').innerText = 'add item' |
Owner
There was a problem hiding this comment.
where's the shortcut for document.getElementById(X).value?
| </div> | ||
| <div class='menu-buttons'> | ||
| <button id='clear-button' class='clear-button'>clear</button> | ||
| <button id='menu-button' class='menu-button'>add item</button> |
| // load display todo items from local storage | ||
| let list = document.getElementById('list') | ||
| for (let key in localStorage) { | ||
| if(isNaN(Number(key))) |
Owner
There was a problem hiding this comment.
what's that? what failed so u had to add this condition?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
applied fixes following review