The reason for me starting JS was out of plain curiosity to play with the DOM. You might all know how learning goes these days—I started and completed the CodeAcademy course, read a few blog posts—and thought that I was great at JS.
I couldn't be more wrong.
Here are what changes I made to drastically improve how I write JS, and how others read my code.
Started using jQuery
Seriously, with the current state of web, there's quite no good reason why you shouldn't use jQuery. Previously I used polyfills and the sort in vanilla JS code to ensure compatibility, but why spend time reinventing the wheel?
I distinctly remember that the last few slides of an amazing presentation by Chris Coyier changed my mind, and I started using jQuery.
I still remember the (poor) 'vanilla JS' tutorials I wrote—Those weren't backward compatible, and the code was, frankly, ugly.
Read a few great books
I believe that reading the two books, and seeing the way the experts wrote JS, opened my eyes and made me think—"Wow, Namanyay, you write shit code. These guys are so better!" and made me want to improve.
From this book, I learnt the revealing module pattern, a pattern which I now love and use extensively in JS. I believe this is the single most important change that improved the quality of my JS.
…And I learnt all of this only because I admitted to myself that I had been writing poor code, that I could improve. If I hadn't understood that, I would've remained the amazing JS programmer I thought I was.
Now, I'm admitting my mistakes, and learning even more.
That's why we all are here for, correct?
Discuss on Twitter