Going from C++ to Java Script experience

Going from C++ to Java Script experience

My experience transferring from c++ to Javascript

When I first started programming my very first language was C++ as my main goal was to get into game programming and C++ is the industry standard. However, now I have shifted to web dev and I am currently learning JavaScript. There are a few things that I realised when I transitioned over. Firstly, when I first started JS, I thought it was 'weird' compared to C++. In C++ you have to specify each variable that you create so if I want an integer I need to put int num; while in JS all you do is use the keyword let and it will auto assign it for you. But that is not the weird part. What I found the oddest is that you don't have half as much freedom in JS as you do in C++. In C++ I can manage my own memory and create pointers that point to specific locations in the memory. In JS there is none of that. You can't create pointers and there is a garbage collection that manages your memory for you. This was very odd for me as I was used to maintaining my memory and using it to my advantage and not having that in JS made it feel less powerful. However, when I transitioned over a lot of the things are similar like loops, arrays and things like that. This meant that it was easy to get the hang of JS as it seemed like a very simplified version of C++. To call array properties in C++ you have to end it with () for example if you had a vector and wanted the size of it you would call myVec.size() but in JS you don't have to. You would just call this on your array myArray.length this seems much cleaner and simpler but I guess I was used to using the brackets so it was strange not adding them in anymore. JS feels more rewarding in my opinion at the very begging as you can hook it up to HTML and visualise what you are creating more easily than you can with C++. For example, if you have a bunch of images and want to display them depending on a value it's very easy to do it with JS as you can grab to element ID and change the CSS. While in C++ to even begin drawing a pixel you have to have a graphics library like SFML.This makes C++ feel less rewarding with more work naturally needed to get things done.

C++ and JS are used for different things and there are advantages and disadvantages to them both, they are both great languages that have similarities and differences.