Understanding JavaScript confusion
JavaScript is an incredible language that has been the engine of transformation for web application development. I love JavaScript and will extol its virtues to anyone foolish enough to ask; it is one of the most fluid and expressive languages I have used.
That said, JavaScript is a little odd and it causes confusion. At first glance, JavaScript looks like any other programming language, which gives programmers new to the language a sense of confidence. That confidence does not last, and it is only a matter of time until the separate searches on Stack Overflow begin.
JavaScript isn’t like other mainstream languages. To see the most confusing features, replace the contents of the index.js
file with the code shown in Listing 3.7.
Listing 3.7: Replacing the contents of the index.js file in the primer folder
function sum(first, second) {
return first + second;
}
let result = sum(10, 10);
console.log(`Result value: ${result...