Practising What I Preach (TO DO List Exercise)
I'd said one should do the Duke University To-Do-List exercise every so often to maintain confidence. I stand by it. It takes about 45 minutes the very first time - following the tutorial. Took me almost 90 minutes today starting from a blank codepen.
Try it again with no recourse to a walk-through doc, and you learn so much more - so many new questions come up.
In the old implementation, now I realize I have a bug - a task could be "done" or "important", but not both. So, if I had a task that was "done", and now I clicked the "important" button, it's class would change and I would no longer be able to delete it :)
Another feature added : return focus to the text field for task-name after adding the task - that's a cool one - probably more useful for testing than anything :)
item.classList.contains(name), .add(name), .remove(name) - your best friends.
When you call a function, use onclick="funcName(this)" or "funcName(this.parentNode)" to send the element or its parent (if element is a button, you want to send the list-item that this button belongs to :)
A sad day - found Chrome is really useless - slows down so much if you open W3schools :( Have to use Edge now to follow links..
Comments
Post a Comment