What I learned binge-watching Namaste JavaScript
Last Thursday (18th November), I spent the whole day going through a great beginner JavaScript playlist on YouTube: Namaste JavaScript
I also live-tweeted while I learned and watched these videos here:
Here are some things I learned/realized while learning online:
Learning
Dedicated time (short or long) is great for learning
I prefer learning a little bit every day but a dedicated larger timeslot for learning is also great.
Spaced repetition rocks
This wasn't my first time learning about the basics of JavaScript, this course refreshed a lot of JavaScript for me and also revised some concepts I had learned and used but had completely forgotten about.
Summarising improves learning
I spent a lot of time thinking about how to summarise what I learned in memes. This automatically made me recall what I learnt. Expressing what I learned in my own words made the picture clearer in my mind.
Classrooms were fun
I also made a lot of memes around what I was feeling while watching these videos. These were unrelated to JavaScript but made me think about all the gossip we did on the backbenches of our classrooms.
Passionate teachers are effective teachers
Akshay's love and admiration of JavaScript and programming came through in these videos and it made me complete 15+ videos in the same day.
Interview style lectures are effective
As I went through Akshay's closure interview video, I realized this was a really good way to learn more about any topic.
Twitter loves Memes
My Twitter network loves memes. I am not even a teen and even my half-baked memes got a decent response.
Threads are difficult to update
Twitter makes it extra difficult to make threads. After I had added 10 odd responses to a thread, I had to scroll, click on show more before adding the next message to the thread.
Funny, Interesting, Useful
Twitter still goes for funny as far as likes go. But retweets seem to have an angle of usefulness.
JavaScript
Two-step execution for optimization
Compiled languages do a lot of hoisting, tail recursion, and other optimizations during compile time. JavaScript does this during the memory creation phase.
Use debugger for learning JS
Using a debugger and stepping into the execution environment is a great way to learn about what's going behind the scene.
Var, Let, and Const
Stop using var. Let and const makes us better programmers and they do what we usually expect from them. var can be highly unexpected. The temporal dead zone is a blessing in disguise.
undefined != Not defined
In the memory creation phase, all variables are initialized with the value undefined. Try not to assign 'undefined' to your variables.
JavaScript's Lexical environment and scope chain
Lexical environment = Local memory + Lexical environment of a parent. This ensures variables declared outside a block/closure are available to internal blocks.
First-class functions
JavaScript functions can be assigned to variables, arguments and can also be return values of other functions.
Closures remember
Closures carry their parent's lexical scope with them and can cause memory leaks if not used wisely. Closures + functions as first-class citizens are a superpower.
Constructor functions
These along with closures make for some really powerful encapsulation mechanisms.
Callback functions
They give access to the asynchronous world within a synchronous language. They are added to the call stack based on triggers (time, user action, network, etc.)
Learning JavaScript and live-tweeting was a rather engaging activity for me and I plan to do this again in the future.