Just JavaScript course is a shift of your JS mindset

Just JavaScript course is a shift of your JS mindset

I`d like to share my personal feedback on Dan Abramov`s and Maggie Appleton`s course - Just JavaScript Course that I came across really accidentally. It always happens that you find something really good when you stop looking for it.

I`ve been working with vanilla JS for a while before I switched to React and of course I still use JS rules and logic every day. However, I had this gut feeling I still didn`t know it well enough. And what well enough actually means, can it even be enough one day? I sometimes couldn`t easily figure out the nature of the bug or accidentally mutated smth I shouldn`t have touched. I felt I didn`t see the full picture.

The books like The definitive JS Guide, the series You don`t know JS, and Eloquent JavaScript helped a lot, but the theory was written with a bit too cold and dry language, the examples still had classes, vars and old data fetching techniques, so I kept searching...

Recently I`ve spoken with my colleague and he mentioned that the books I`ve already read are fully enough and I needed to calm down, breath and just have more practice, so everything would slot into place. I relaxed for a bit. But not for a long time)

A few days ago I came across Dan Abramov`s blog Overreacted.io, reading some optimization lifehacks for React and here`s how I saw the article about Just JavaScript Course. Dan simply promised that this course would totally shift your JS mindset, after you go through 10 episodes with reading material, cool animations and tasks. I was intrigued and itchy. On that same day I was already going through episode 1 and it took me 3 or 4 days to complete the program. I don`t recommend, though, to go through the modules in a rush, but my excuse is that I would get back to each module once in a while to keep it fresh in memory and reveal something I might have missed. Another excuse is that I just couldn`t stop reading.

I certainly don`t want to spoil the course revelations, I`m sure everyone would get what they`re looking for and fill the gaps they might have. This is just a short summary I`d like to keep here, and maybe it will inspire you, unknown reader, to check it out too:

  • Our mindset about interaction with values and value assignment is wrong. We need to start thinking of them separately, our code interacts with those values, but....they exist in a separate space. Very far away from us and we don`t have any control over primitive values. There is a great analogy that we can associate ourselves with Little Prince by Antoine de Saint-Exupéry. He`s standing all alone and looks at the distant stars. Those stars are our values. We see them from a distance, we can interact with them, but they don`t exist inside our code. Think about primitive values in this way - you can point to them, but you can`t create, destroy or change them. They will always stay where they are, unchanged, immutable. You can only reassign your variable (if it`s not declared with const) with a new value.
  • If we think about primitive values like distant stars, then objects and functions are more like asteroids floating around your planet. They’re not part of your code, but they’re close enough to manipulate. Everytime we use {}, we create a completely new object, so it`s a well-known thing that {} === {} will always be false, no matter how similar they look to us. I also refreshed my knowledge about mutating nature of objects and how careful we need to be when we do smth like let watson ={address:sherlock.address}, because then when we want to change city (watson.address.city = "NY"), we`ll change it for Sherlock too. Well, it`s quite obvious example here, but Dan shares a couple of tricks (besides using spread operator) how we can avoid mutation for sherlock in this case.
  • Think about variable not as a box, like everyone teaches in the books, but rather as a wire that points to specific value. If we reassign, we change the pointer. If we talk about objects, e. g: let book = {pages: 100}, we can describe this in the following way: "variable book points to the newly created object, who has property pages which points to the value 100." Pages property belongs to the object itself, not the book.
  • Variable always points to a value and never to another variable, even if we have smth like: let cat = bob. Bob is a separate variable, but cat doesn`t point to it, but to its value. I don`t know why, but I didn`t think about this in the past.
  • There is no such a thing like nested objects, if an object is inside another object, it`s just a separate object, but it`s not actually nested inside the parent one. It exists as long as there is a pointer to it. For some reason it was easy for me to imagine that nestedness, but if fact they are all independent objects.
  • Dan dedicates a special episode to Prototypes. I know this is #1 topic on the interviews, but then after you get a job, you forget about this topic and remember one key statement that everything inherits from Object.prototype, it`s the topmost prototype for any value, be it object or primitive. But what happens if we have longer prototype chain and how it all works together, how to check whether it`s object`s property or the property of its upper prototype, how to easily move through prototype chain, what happens if we add new properties to the parent prototype or add there same property name that object`s prototype already has - you`ll learn more on that from the course. Or maybe you`ve already known about all of that, so in this way, you`1l have a small refresher and enjoy cool (no, gorgeous!) animations and exercises.
  • I like how Dan explains the word "mutate". Why don`t we simply use "change"? This is what we actually mean. But... by saying mutate we really involve some sinister shade to it, so we can think twice - whether accidentally we`re mutating another object that`s not supposed to be mutated. However, mutation is not always bad, sometimes this is something we intend to do on purpose, so that`s totally fine.
  • The language of the course is so rich, full of metaphors, idioms, jokes, excellent analogies. I definitely added a couple of good phrases to my vocabulary. One of them is take a leap of faith))

So I encourage you to take a leap of faith and check out this course. Let me know what your impressions are and what surprised or amused you the most. Also maybe there are some incorrect statements or smth I missed, let me know, I`m very open to dialog:)



To view or add a comment, sign in

More articles by Natalia Senyk

Insights from the community

Others also viewed

Explore topics