11 Facts About JavaScript (JS)
Explore 11 unexpected facts about JavaScript (JS) that highlight its capabilities, unique features, and reasons for being an essential element in present day web development.
FACTS ABOUT


JS Logo Icon (credit: icons8)
Have you ever been amazed with JavaScript but yet a little confused by it? You are not by yourself. JS is both a buddy and a mystery for lots of developers. You are developing interactive buttons with ease one minute, and then you are questioning why typeof null returns "object" the next. JavaScript offers sufficient special features to keep new users and experienced developers on their toes, as well as abnormalities that defy logic and an interesting past that appears like a tech novel. This blog post article examines 11 remarkable facts about JavaScript, some of which are difficult to understand, some of which are interesting, and some of which are truly impressive. These facts help to clarify why JavaScript remains one of the most important technologies in web development to this particular moment.
JS Was Created in Just 10 Days: Ten days, indeed. While employed at Netscape in May 1995, Brendan Eich created the initial iteration of JavaScript. There was a huge urgency since Netscape needed a scripting language that would execute quickly in the browser. Eich came through. Although the outcome was obviously far from ideal, it established the foundation for a language that currently powers most of the internet. It is similar to producing a rough copy of a novel and then discovering twenty years later that it is being used to manage billion-dollar companies.
JS Has Nothing to Do With Java: One of the most widespread misunderstandings in the software industry is the term "JavaScript." JavaScript has nothing to do with Java, regardless of what the name implies. They are as unlike as carbonated drink and coffee. The name was a marketing technique; Netscape chose to capitalize on Java's massive popularity at that moment in time. Since then, developers have been attempting to figure out the matter.
JS Originally Had The Name Mocha: The language was once known as Mocha, then LiveScript, and lastly JavaScript prior to becoming JavaScript. It nearly feels like an identity crisis because of the frequent change of name. Surprisingly, to everybody who has had to clarify the distinction between Java and JavaScript to overwhelmed clients or beginner students, "JavaScript" has persisted.
JS Allows Functions to Be Passed as Arguments: The ability to treat functions similarly to any other value is one of JavaScript's greatest capabilities. They can be returned from other functions, stored in variables, or passed around as arguments. JavaScript excels at handling asynchronous code and functional programming techniques because of its versatility. For instance? Consider using JavaScript to treat a function as a regular value by establishing a "setTimeout()" with a function inside.
JS Uses Prototypal Inheritance: JavaScript adopted prototypal inheritance, which is different from class-based inheritance, which is used by most older programming languages. JS objects inherit directly from other objects rather than using classes. This can be challenging for those accustomed to languages like Java or C++, however immediately you understand it, it presents a great deal of adaptability. However, it is additionally the explanation for why inheritance in JS can occasionally feel like navigating a family tree with missing branches.
JS Has Only One Number Type: JavaScript utilizes only one number type, IEEE 754 double-precision floating-point, as opposed to languages that distinguish between integers, floats, and doubles. This results in some strange mathematical behaviour since all integers, whole or decimal, are treated in the same manner. Consider entering "0.1 + 0.2 === 0.3" in the console of your browser. Warning: It returns false. Greetings from JavaScript math.
JS Runs On a Single Thread: JavaScript manages asynchronous tasks like a multitasking wizard because of its event loop, even though it only uses one thread. JavaScript creates the appearance of completing numerous tasks at the same time without really utilizing multiple threads, whether it is managing user interactions or processing an API call. It is comparable to a barista who serves coffee to a single customer at a time while managing to satisfy all of them.
JS Can Be Used Outside Browsers: JavaScript was restricted to the browser for many years. When Node.js arrived, everything was different. Servers, command-line tools, and even Internet of Things devices may now run JavaScript. This implies that you can create a whole backend API using your preferred web animation language. Who would have guessed that the same script that controls a menu could additionally process millions of data points or run a chatbot?
JS Treats Arrays as Objects: Many first-time developers are confused by this: arrays in JavaScript are actually objects. Are you not convinced? "typeof []" returns "object" when you run it in your console. JavaScript arrays are simply objects with couple of useful methods added and numbered keys. This addresses several strange behaviours, such as the ability to give arrays specific properties, which JavaScript permits even though you would never do so.
JS Hoists Variables & Functions: Variable and function declarations are hoisted in JavaScript, which means that they are positioned at the top of their scope prior to the code execution. However, just the declarations, not the initializations, are raised. Therefore, hoisting is the explanation for why executing a function prior to its declaration continues to function (although implementing the same with a variable could not). JavaScript seems to be reading your code in advance and declaring, "I got it, I will save this for later."
JS Has Dynamic Typing: Variables in JavaScript are subject to type changes. Without generating an error, you can change a variable's value, then convert it to a string, and finally to an object as shown below:
let data = 42;
data = "forty-two";
data = { value: 42 };
Because of the above, JS is incredibly versatile and somewhat surprising. When used by skilled engineers, it can be very effective, however if you are not cautious, it can soon turn into a chaotic situation.
Summary: Amazing, Strange, & Here to Last
JavaScript is similar to that unreliable buddy that confuses and irritates you, yet continually manages to get through when it counts. Even though it was only developed in ten days, it has been influencing the internet for thirty years. Embracing JS's uniqueness and advantages can transform frustration into admiration, regardless of how long you have been coding in the language. Acknowledge its characteristics; they contribute to the uniqueness and irreplaceability of JavaScript as a tool for present-day web development. Take a deep breath and keep in mind that JavaScript was never intended to be flawless the following time your code functions strangely. It was supposed to function. And it continues to function anyway.