C++ for JavaScript developers
At the end of 2017 I committed myself to learning a new programming language as one of my resolutions for 2018. I’ve spent the last few months jumping between client projects written mainly in JavaScript and learning C++ in my own time. I am still nowhere near proficient at it, but it is a great time to share with you a few of my conclusions.

New perspective
JavaScript, being a very forgiving language appears to be an attractive choice for new programmers. It works the same on every single browser (I mean the core concepts, not the API implementations so spare your evil comments please) and the same applies to the server world using Node.js. To spin a script you don’t need much more apart from the application that you already have — a browser. You can use a browser’s built-in console, a simple text editor like Visual Studio Code or full-blown IDE (integrated development environment) like WebStorm — the tool doesn’t matter — the interpreted nature of this language enables you to view feedback at runtime with no required configuration whatsoever.
C++ on the other hand requires you to do some solid homework before you launch your first line of code. Having a good IDE helps a ton. Visual Studio by Microsoft, the superb CLion by JetBrains or Xcode are great choices to consider. The compiled nature of this language will require you to brush up on some basic knowledge about memory allocation and the architecture that you are working on and building for.
Learning C++ makes you a better JavaScript developer
One of the plethora use cases of low-level programming languages like C++ is building other programming languages. Yes, you guessed it — JavaScript is written in C++. To be precise, the engines that drive the most popular JavaScript engines (V8 within Google Chrome and Node, Chakra for Microsoft and SpiderMonkey for Mozilla products) are mainly compiled from a C++ code base. MDN Web Docs is a fantastic resource and I use it all the time but sometimes it is not enough. I cannot describe how cool it is to read V8’s source code and actually understand what is going on.
Having exposure to a strongly-typed programming language (one that requires data type declaration) and a basic understanding of memory management makes you think about your script in a totally different way. Despite the fact that JavaScript engines are doing tons of optimisations for you, you can avoid performance pitfalls by writing an API that skips unnecessary steps at runtime. Mathias Bynens from V8 team recently gave a fantastic talk on this subject — V8 internals for JavaScript developers.
Leaving JavaScript fatigue behind
I bet that a new JavaScript framework will land on GitHub before you reach the end of this article. But I just learnt React. Damn! My Pinboard reading list is full of JS related articles, tweets, conference talks and tutorials on YouTube! There is no way that I will keep up with this endless dungeon of JavaScript resources.
Actually there is a way to get out of JS fatigue! Forget about your current stack and let yourself soak in a new skill (C++ in my case). Don’t get me wrong, I still learn new JavaScript stuff on daily basis but only when I really need it. I ignore tweets about new libraries and frameworks, tutorials on Youtube and Medium articles. Ironically — accordingly to section above — doing so makes you a better JavaScript developer anyway.
Helpful resources
For me the most efficient way of learning is watching videos with a great balance between theoretical definitions and practical examples. It took me quite a while to find some great resources about C++ and after a few months I’m ready to share with you my top ones!
The C++ playlist by Yan Chernikov is one of the best resources that I’ve found. It has a good balance between theory and practice, it keeps an optimal pace and is interspersed with a great sense of humour that makes it a perfect stating point for C++ newcomers. The C++ playlist by Derek Banas is another one that is a little less energetic but filled with great theoretical explanations.

Whenever I struggle with a particular subject I dig into The C++ Programming Language (4th Edition) by Bjarne Stroustrup. This publication is written in an academic manner by the author of the C++ language. Reading verbose tomes like this one is not my preferred way of learning, but it is worth keeping on the shelf.

More, more, more…
I am certain that between purely frontend oriented articles you will find some low-level related content on this website soon. I highly encourage you to learn a new programming language — I found the experience really exciting. If you have some similar experiences, please share your journey in the comment section below. Do you know any resources that can help me on my journey? Please share it by all means. Thanks a lot for reading and keep on hacking!
I did the exact same thing and I love working with c++ together with javascript to power up my node apps!
Love your posts, stay awesome!
Thanks a ton for kind words. Have a good one!
You might also be interested in "More C++ Idioms" wiki book https://en.wikibooks.org/wi... which isn't exactly a book in the right sense but contains a big collection of widely used idioms and patterns in c++.
On youtube there's a channel called "C++ Weekly" https://www.youtube.com/wat... which discusses very interesting topics and approaches in using c++.
Thanks a lot for these resources. Hero!
Have a nice day @mohammedelafifi:disqus
JavaScript is unreal. I just got into it this year and am amazed to see how many frameworks and such are out there. I have ignored them so far as I am still learning "vanilla" JavaScript. I recently started learning Java too. They are different, but I find Java is giving me a good understanding of programming concepts overall. This article encourages me to add C++ to my list... In the future when I'm comfortable with Java.
Wow, cool. Thanks for reading and lat me know later on how is going your C++ exploration. Have a nice day.
I'm coming back to C++ via the cpplondonuni YT just to update and try to gain a better understanding of the language.
It's very complex to go from core concepts in C++ or C to doing things. Thankfully I'm not asked to use C++ too often (maybe a few times per-year), but you're doing well if you understand the JS codebases.
I Have to put most open source code through `gcc -E` so that I can be sure I'm not mis-understanding its use of macro's and templates. Things have improved in C and C++ since the days when core types could be ambiguous, but it still seems like you'd need 3 screens. One to run a thing, one to develop and another to reference esoteric parts of the code.
For resources I've quite enjoyed Kate Gregory talks YouTube (free) & courses on Pluralsight (paid). It would be wonderful if I stuck with C++ this time, but I doubt I will. I like having high-level features designed by teams to use. Not having them can feel like treading through mudflats.
Look forward to reading some insightful articles on C++ from you.
Good luck! I am doing the same with Rust. And have seen the same benefits.
Jumping to Typescript helped me a lot.. no more JS fatique...
This is great, thanks for the inspiration! I'm especially enjoying Yan Chernikov's C++ videos
He is great isn't he?! Thanks for reading!
I really want to learn c++ (mostly for wasm), but I was having trouble finding good resources for learning the language. Thank you for this!
I am glad that you found it useful.
I like C++ a lot. I'm beginner in this world. Right now I'm reading Accelerated C++ (it's old but it is still relevant). I don't really enjoy reading a thick book (over 500 pages). I have C++ Primer as a reference book. I also watch C++ videos from Cherno. He is a really great teacher. For practicing, I do it on Hackerrank, SPOJ. I also want to share a series C++ is Chili C++. He is really good at teaching C++, but some people do not like his style.
I envy :)
great article. I also wanted to share this as an excellent resource for c++ and development in general. https://www.youtube.com/use...
Thanks a lot for great resource!
CPP is mostly OOP. Whole JS ecosystem is going towards to FP.
IMHO I see more advantages for FED about learning Haskell and Rust instead of cpp.
CPP is mainly OOP. Whole JS ecosystem is going towards to FP.
IMHO I see more advantages for FED about learning Haskell and Rust instead of cpp.
Haskell and Rust exactly. They'll enlighten your mind the most.
I moved from c++ to js long time ago, for business reasons, but my heart is still there.
Probably the right order!
hmm, you really made me to think on it, will start to learn c++ soon :D. Btw, thanks for sharing resources..
Nice article. I like it. Planning of learning a new language too. its either Swift for IOS, C++, or Python. but im kinda a afraid about the DEEP CS learning in C++. Did you study math first or any algorithm practices? :)
btw. do you have a framework to make this comment thingy? :)
What do you mean? For comments section I use Disqs, but I wouldn't recommend it it you are starting a new website.
https://disqus.com/
yup! than you so much. :)
why not? disqus is quite a good commenting system it helps engagement, as users can read responses for their messages from other websites,for me that is a great plus.
Performance / tracking / privacy / obtrusive adds :(
except performance those are minor things, no cookies? no comment section, as simple as a bool, and performance can be solved if loaded asynchronly
If you are asking about this to-do app presented on a first photo it is a Things. Absolutely love it!
https://culturedcode.com/th...
No I do not have any background in maths and CS at all. It quickly caught me up but it was a great experience anyway. I really enjoyed learning new language, its ecosystem and its paradigms.
thank you for the response. i might learn swift for my next language. good luck
Thanks a lot for the article. I also do JS on a daily basis, and I'm also learning C++ with the intention to be able to understand browser engine sources (and possibly contribute too).
This is exactly my intention. I am glad that you enjoyed the post. Good luck with C++ @pomerantsev:disqus.