DEV Community

gagecantrelle
gagecantrelle

Posted on • Updated on

Comparing JavaScript and C++

As you may know there are different types of coding language's that you can use to code, for example JavaScript, C++, and ect. But you might be wondering which one is better to use and why. Some coding language's could be easier to learn but have problems when working on certain subjects. There also be different ways to run certain codes like logging to the console. For now let Just look at two coding language's JavaScript and C++.

Let compare JavaScript and C++ syntax, You might be wondering but what are syntax. Syntax are specific charters that are given specific set rules to follow. Each programing langue has the own set of syntax with specific rules.
JavaScript
.Multi-paradigm language
.support event-driven
.functional
.imperative programing style
C++
.rigid
.object-oriented
.look like old guard program
.no forgiveness for missing a semicolon

When choosing A Language to use for a project you probably would like a reliable coding language. since some projects may require the code to run faster or for the project to be completed done, within a set time. JavaScript is A high-level language, which is more closer to human language, and more closer to binary. this allows you to do more on a single line of code. With C++ is a
mid-level language, meaning most stuff that you have in JavaScript is not in C++. So, you would have to code some custom function and download stuff to get C++ working in something other than
Windows. Another think know that C++ is Statically typed while JavaScript is Dynamically typed. Statically typed is when you have to declare what type a variable you're creating. when that
variable is created you can't change it type. Meaning that a variable that holds a string can't hold a number. Dynamically typed is where you don't have to declare what type a variable your creating. after you create a variable you are able to change it type. Finally, C++ is a complied language, you have to complied you code before you are able to run it. Depending on your code it code take a few second or a hour to compiled. If you want to
change some code or debug your code you will have to compiled your code every time.

Next you probably want to know which it the fastest out of JavaScript and C++. The falsest of the two is C++, now let look at why C++ is faster than JavaScript. The different between there speed is ok at best with very little in time different. Because C++ is mid-level language it is closer to machine code. allowing what you coded in C++ and compiled to run the fastest. In JavaScript case because it easier to type code, the longer it take to interpret the code during run time. if you were to run a speed test using a simple code like looping # times and console.log the time. you would see that JavaScript will finish the code in one second, while C++ can finish it in under one second.

All sites I used to gather information of this blog will be below here. this blog was created for a assignment.

https://careerkarma.com/blog/javascript-vs-cplusplus/
https://devmountain.com/blog/what-is-syntax-in-computer-programming-javascript-101/#:~:text=Syntax%20is%20the%20set%20of%20rules%20that%20define,those%20words%20when%20we%20give%20the%20computer%20instructions.
https://www.youtube.com/watch?v=vq1FYdl7IHs

Top comments (0)