DEV Community

Discussion on: How To: Build A Simple Search Bar in JavaScript

Collapse
 
am20dipi profile image
Adriana DiPietro

I appreciate the feedback, but there are ways of providing "criticism" as you claim without condescension. Yes -- there are many ways to achieve a goal with code -- we all know that. This is a beginner's ~guide~... guide meaning do things the way you would like and follow my outline to your desired effect. It's nice to see that we all can think and improve on others; but try to say it nicer. Also "shorter" does not equate to better. Sometimes "longer" improves readability, especially for beginners. Nonetheless, I appreciate you taking the time to read and comment on my post. I like continuing the conversation past the post :)

Collapse
 
travissanon profile image
Travis Sanon • Edited

I'd say that

function clearList() {
  list.innerHTML = ''
}
Enter fullscreen mode Exit fullscreen mode

Is easier to read than

function clearList() {
    while (list.firstChild){
        list.removeChild(list.firstChild)
    }
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
zippcodder profile image
Deon Rich

I agree. Good article, great project for people still starting out.

Thread Thread
 
am20dipi profile image
Adriana DiPietro

Thank you Deon!

Collapse
 
alexfstack profile image
Alex-FStack • Edited

Boris made some great points on how to improve the code, did not see anything 'condescending' in there, all positive criticism and helpful quality tips, seems you cant take any... attitude problem?