paint-brush
You are learning JS wrongby@benjcal
13,923 reads
13,923 reads

You are learning JS wrong

by April 13th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

A friend on mine, who is learning JS, showed me proudly a clock on an html page. He told me that after 7 hours he finally got it to update every minute! I smiled at him and said: <em>“I think you are ready to learn a JS framework.”</em>

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - You are learning JS wrong
undefined HackerNoon profile picture

What I’d say to my younger self when learning development

“ I just can’t learn JS :-( ” by Louis Blythe on Unsplash

A friend on mine, who is learning JS, showed me proudly a clock on an html page. He told me that after 7 hours he finally got it to update every minute! I smiled at him and said: “I think you are ready to learn a JS framework.”

That same person previously had the hardest time trying to make sense of JS, why in the world would I need a function? Why is my function not working, I already wrote it? — he hadn’t called it — Why do I need an array for? I can just have a couple of variables…

In a similar fashion I have meet many people that shy away from coding because it is “hard”, or “you have to be a genius to get it,” or they can do everything they want with HTML/CSS and JQuery.

Back when I was learning JS I remember thinking, while reading Eloquent JavaScript for the third time, “Why in the world would people care about inheritance or _this_ or arrays? Why not just use a variable and be done with it? Why are they just complicating things by putting them in an object?”

The experience was very similar when I was teaching Algebra at a middle school. _a - b = a + -b_ I’d say with the blank eyes of my frustrated students staring back at me. It was puzzling to me how they couldn’t understand something “so logical.” And then, the insight! There was an activity we needed to organize but we couldn’t find a number because we weren’t sure about something that could change (vary? as in variables… WOT?). And with a new interest we took a look into those weird equations and formulas that Mr. B (that’s me) was teaching them and… they finally made sense! They were actually useful! (You mean that math can be used for more than just knowing how many watermelons little Johnny has?) The students were elated and so was I! Math had an answer for questions they had formulated. Before that math was just giving them answers for questions they hadn’t formulated.

Learning Math is NOT about learning things about numbers (well, it is a little bit 😃). Learning math is mostly about how to use different methods and tools, to solve problems, may they be for science, cooking, personal finances, space exploration or how many apples little Laura has left.

I believe the same thing happens when learning JS, or any other language or skill for that matter. Out of context, a book or online course or university course is giving answers to questions the student hasn’t asked.

Learning JS is NOT about learning (memorizing) JS, it’s about learning a tool in order to solve problems.

I recently read an excellent article on how to be a better developer by learning the meta skill of problem solving. While I agree strongly with that article, I believe that in order to even make sense of development you need to be a little exposed to the problems you are trying to solve.

Working as a CTO for a startup I had the opportunity to deal with a couple of CS interns and it was kind of a disappointing experience. It seemed like those students had learned a lot of theory, memorized how to write a for or a switch, but had no clue what those were actually used for.

This happens even more when the person is self-taught and decides to pick up a book or enroll in an online course for, say, JS. It can be very frustrating and confusing because the book or course is providing answers to questions the person hasn’t yet formulated and the brain has a hard time figuring out where to store that information and how to process it. I spent the longest time trying to explain to somebody why they would like to learn what a function is and how it works. Their question was, “Why would I need a function if I can just have my whole little calculator app in one file?” It was frustrating to say the least. But as soon as that person tried to do something a little more complicated than a cli calculator, it was just beautiful to behold her insight about functions and how useful they actually were!

So, what can you do to learn JS better?

First, don’t panic!

don’t panic!

With many courses you are told to practice, practice, and practice… but practice what? ANYTHING! Try to make something that is a little over your head, use your current knowledge, fire up Adobe Muse or Dreamweaver, if that’s what you know and try to build something (a todo app is a good place to start). Don’t look at anybody else’s code, and don’t copy/paste from StackOverflow just yet… find where the limits are of the current tools that you know and knowledge you have and then, and only then, you’ll be ready to acquire and understand new knowledge!

Many courses give you challenges and exercises… don’t skip them because you feel like you get the content (I used to do that all the time 😁), they are actually designed to challenge you, stretch you a little bit, get you to the point in which you realize that you don’t know. Then you realize that you don’t get frustrated because you don’t know! NO, quite the contrary, when you know that you don’t know, that is when you are ready to learn what you don’t know!

Let me just say that again, when you find a mountain in your way, that’s the moment you’re ready to learn a way to climb it! It’d be very hard to understand why you would even need a rappelling rope if you have never seen a mountain.

And above all, don’t stop learning! When you are doing something that feels a little too complicated or hard, usually, I have found, I’m doing it wrong, and there’s a tool or skill to accomplish that in an easier and more efficient way. An example is a coworker that was uploading a file to a web server every morning at 5:00AM for the past 5 years… wow! But there’s cron. In another occasion a friend was trying to erase a couple thousand files but keep some other thousand, thus the apparent solution was to select all the files-to-be-erased on finder and erase them. After a weekend of frustration we wondered, _what if there’s a BASH script was can write to fix this? A_nd there was! Five minutes later the task was over!

Or just try building a todo app only with JQuery… You’ll see what I mean.

So, keep being awesome and learning and building cool stuff!