Skip to content
Dennis Morello

5 Things You Might Not Know About JavaScript

JavaScript is a programming language that has been around for over 20 years. It's used in many different ways, but what are some things you might not know about it? In this blog post, we'll explore 5 things you might not know about JavaScript.

Introduction

JavaScript has undoubtedly become one of the most essential programming languages in the world of web development. As the backbone of interactive web pages, it enables developers to create dynamic and engaging user experiences. You might already be familiar with the basics of JavaScript, but there are numerous lesser-known aspects and hidden gems within the language that can enhance your coding skills and expand your understanding.

In this blog post, we'll delve into 5 intriguing things about JavaScript that you might not be aware of. Whether you're ready to impress your colleagues with newfound JavaScript knowledge or simply eager to enhance your own programming prowess, this blog post is for you. Let's dive in and uncover the hidden gems that await us in the vast world of JavaScript!

1 - "JavaScript" is trademarked by Oracle

The name "JavaScript" is a trademark of Oracle Corporation in the United States. The trademark was originally owned by Netscape Communications Corporation, which created the language in 1995. In 1996, Netscape transferred the trademark to Sun Microsystems, which was acquired by Oracle in 2010.

A trademark is a legal protection that grants exclusive rights to use a particular word, phrase, symbol, or design to identify and distinguish a product or service.

As a trademark holder, Oracle has the authority to control the usage of the term "JavaScript" within the United States. This means that other entities must seek permission from Oracle or adhere to specific guidelines if they wish to use the term in a way that may be covered by the trademark. Unauthorized use of a trademarked term can lead to legal repercussions.

It is important to note that while the term "JavaScript" is trademarked by Oracle in the United States, the programming language itself is an open standard governed by the ECMAScript specification. This means that the language can still be used and implemented by developers and organizations globally, regardless of the trademark ownership.

In 2022, Node.js and Deno creator Ryan Dahl wrote an open letter titled Dear Oracle, Please Release the JavaScript Trademark, where he urges Oracle to release JavaScript trademark.

2 - JavaScript and ECMAScript are not the same thing

JavaScript is often referred to as ECMAScript, but the two terms are not interchangeable. JavaScript is a programming language, while ECMAScript is a standardized specification that defines the syntax, semantics, and features of the JavaScript language. It provides a standardized framework for implementing JavaScript across different platforms and browsers.

ECMAScript is maintained by Ecma International, an industry association, and undergoes regular updates to introduce new features and enhancements.

It is important to note that different versions of JavaScript correspond to different editions of the ECMAScript specification. For example, ECMAScript 5 (ES5) introduced significant improvements and features to the JavaScript language, while ECMAScript 6 (ES6) brought about even more significant changes, such as arrow functions, classes, and modules.

In summary, JavaScript is the widely used programming language that follows the ECMAScript specification. ECMAScript provides the standardization and guidelines for implementing JavaScript across platforms, ensuring compatibility and allowing developers to write code that can be executed consistently.

3 - JavaScript is a dynamically typed language

As in every programming language, in JavaScript variables and values have types associated with them. Although JavaScript is often referred to as a dynamically typed language, meaning that variables can hold values of any type, it does have a type system that determines how values can be used and manipulated.

JavaScript employs a loose type system, where type coercion can occur implicitly, allowing for flexibility in operations between different types. For example, the + operator can be used to add numbers or concatenate strings, but also to cast a value to a number.

There is also an operator called typeof that can be used to determine the type of a value at a given point in time. It returns a string representing the type of the operand.

4 - JavaScript has seven primitive types

As of ECMAScript 2020 release, JavaScript has seven primitive types, which are the building blocks of all JavaScript values:

  1. Boolean: Represents a logical value of either true or false.

  2. Null: Represents the intentional absence of any object value. It is a primitive type, but its sole value is null.

  3. Undefined: Represents a variable that has been declared but has not been assigned a value. If a variable is declared but not assigned a value, it is automatically assigned the value of undefined.

  4. Number: Represents numeric values, including integers and floating-point numbers. JavaScript uses the double-precision 64-bit binary format (IEEE 754) to represent numbers.

  5. BigInt: Introduced in ECMAScript 2020, BigInt is a primitive type that provides a way to represent arbitrarily large integers. It allows developers to perform operations on numbers beyond the limits of the Number type.

  6. String: Represents a sequence of characters enclosed in single quotes (''), double quotes ("") or backticks (``). Strings are used to store and manipulate textual data.

  7. Symbol: Introduced in ECMAScript 2015, Symbol is a primitive type that represents a unique identifier. Symbols are often used as keys in objects to avoid name collisions.

These primitive types in JavaScript are immutable, meaning their values cannot be changed once created. They are distinct from objects, which are composite data types that can store multiple values and have methods and properties associated with them.

Another property of primitive types in JavaScript is that they are passed by value. This means that when a primitive value is assigned to a variable or passed as an argument to a function, a copy of the value is created and stored in the variable or parameter, and any changes made to the variable or parameter will not affect the original value.

5 - JavaScript is a "compiled" language

In the context of JavaScript, the term compiled can be misleading. Unlike languages such as C++ or Rust, where the source code is directly transformed into machine code before execution, JavaScript goes through a different process. When a JavaScript program is executed, it is first passed through a just-in-time (JIT) compiler built into the JavaScript engine.

During the execution, the JavaScript engine performs several optimizations, including parsing the source code, optimizing the code based on various heuristics, and generating machine code or bytecode for efficient execution. This dynamic compilation process, performed by the JavaScript engine at runtime, helps improve the performance of JavaScript programs.

It is worth noting that the compilation process in JavaScript is different from the traditional pre-compilation step found in languages like C or C++. In JavaScript, there is no separate compilation step that generates an executable file beforehand. Instead, the compilation happens as part of the runtime execution.

Overall, while JavaScript can be considered a compiled language in the sense that it undergoes compilation during runtime, it is more accurate to describe it as an interpreted language with a just-in-time compilation process.

If you want to go deeper, Kyle Simpson explores this topic in detail in his book You Don't Know JS Yet.

Conclusion

JavaScript never ceases to surprise and fascinate developers with its hidden depths and lesser-known features. In this blog post, we explored five intriguing aspects of JavaScript that you might not have been aware of, expanding your understanding of this versatile language.

As you continue your journey with JavaScript, remember that there is always more to explore and learn. Embrace the ever-evolving nature of this dynamic language, and continue to discover new facets that will enhance your development skills.