Recently my friend asked me if his son could learn JavaScript programming. The boy is 12-year-old and has been interested in programming for awhile. He’s currently taking classes at school which is good but he wants to do it on his own too. So if you’ve been wondering if it would be possible to teach a 12 year old (or younger, for that matter) how to code in JavaScript, read on.
A 12 year old can learn whatever they want. If they are motivated to do so, they will be able to learn. If they aren’t, nothing you can say will change that.
I’ve seen people who were born at the beginning of the 21st century learn to program before even entering the school system. If the child is one of those people, (s)he can do it. If not, well, they might have to wait until they reach some older age before they get interested.
There is no “right” way. You just need to make the learning fun for your child. If they have an interest in programming, they’ll learn it.
Link their learning with their interests
It’s important to give child some kind of mission, like in video games. The best way to learn JavaScript is to actually write programs and try to have her understand what the code does (and maybe even try to debug it). Here are some basic suggestions on how to start.
Give your child a simple HTML, CSS, and JavaScript editor and let them code their own webpage, for example if (s)he’s a fan of the Minecraft it can be Minecraft themed webpage.
Write a small game that your child can play and use JavaScript to program the behaviors.
Design a small web app with a few pages and let your child help you build it.
Think some other ways to link their interests with programming.
I’ve found the best way to learn a programming language for adult is to use it to solve some practical problems. The kids are not different. When they use it to create something, it makes it easier to understand what they are doing.
Tutorials, books, courses
Why not a site that has JavaScript tutorials written for a child’s level?
I’ve watched a lot of different tutorials and have tried to use books like “Beginning JavaScript” and “Head First JavaScript”. These are good books for children who want to learn programming JavaScript. Of course, it depends a bit on a reading skills so it might not be the best solution for younger children.
First things first
The first thing you should do is make sure (s)he has a foundation of math and coding fundamentals before (s)he starts on the computer. (S)he will need these skills in order to understand how to program. From my experience teaching kids programming, they tend to learn programming well after the basic concepts are mastered.
Next, try introducing a program that teaches concepts and a coding language that (s)he might not be familiar with. Introduce her/him to the concept of a variable, and let her manipulate that variable through code. (S)he will then be able to work with those concepts on her own. Eventually, (s)he may get bored with it, but it is a good starter program. After that, introduce her/him to more detailed JavaScript concepts.
Programming environment
I recommend using an environment where (s)he can create and run a program. For example, a simple web browser is a good starting point because (s)he will be able to see the result of her/his programming. Every modern browser have a set of great Developer Tools you can easily access directly in the browser. Not to mention various browser’s add-on and extensions for learners and developers. But for starters just use console in browser’s own Developer Tools.
You can create simple and non-complicated programs, and have her/him run and test them. This gives you both a visual output and a way to test your code. You can create tests such as “if else”, “loops”, etc. in the JavaScript program.
Join community
Community is great way of learning because of competition and group work. Many children who learn programming are already in a community, such as school, course or hackathon. Even if you don’t find a local group to enroll your child, there’s still the chance that you’ll find someone of their age to practice a little with them. You can do it even on a non-digital medium – paper.
These days there are even more online communities you can enroll your child as well. It’s easier and more convenient, especially if you can find anything offline in your area. But don’t underestimate offline communities. In my experience they are much better learning environments for children.
Finally, JavaScript is a programming language like any other, so it can be learned by anybody. However, keep in mind that the main goal is to teach child programming not JavaScript in particular, so if you’re familiar with some other programming language it might be better to start with it first and then switch to JavaScript.