Decoding JavaScript ๐Ÿ‘จโ€๐Ÿ’ป

ยท

2 min read

Decoding JavaScript ๐Ÿ‘จโ€๐Ÿ’ป

Introduction

Many of you may have heard that

JavaScript is a loosely-typed, single-threaded, synchronous language.

But what exactly does this mean?

Let's decode these jargons one at a time.

JavaScript is loosely-typed

  • Being loosely-typed implies that the type of data for a variable does not need to be hard coded and that the value is modifiable.
  • Depending on the type of data you supply for a variable, JavaScript automatically assigns a type to that variable.
  • PROS: Being loosely typed has a lot of advantages for coding, namely speed and flexibility.
  • CONS: Unpredictable or even incorrect results could result from a loosely typed language's poorly enforced typing constraints, which also makes it possible for implicit type conversion to occur at runtime.

Screenshot-2022-01-11-at-12.26.22.webp

JavaScript is single-threaded and synchronous

  • "Single-threaded" means "execution of one statement at a time" and "Synchronous" means "execution in a sequential manner".

  • Therefore by combining them, we conclude that

    • JavaScript executes one statement at a time and in a particular order.
    • It can execute the next line only when the current line is done executing.
  • It keeps a single call stack on which the instructions are popped to execute and pushed to control the order of execution.

  • For the storing and garbage collection of object references, it also has a Heap space.

Conclusion

Now, whenever someone asks you what kind of language JavaScript is, just enlighten them on the same ๐Ÿš€.

ย