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
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
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.
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.
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.