DEV Community

Introduction To JavaScript

Kavya-RGB on August 13, 2022

What Is JavaScript JavaScript(Js) is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting procedural, object...
Collapse
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

I feel the need to clarify some concepts just in case;

Features of JavaScript

JavaScript is NOT -just- an Object Oriented Language (from the programming paradigm point of view), that's a common misconception;
While the language implementation follows the "everything is an Object" pattern (like python and many others) it is a different topic.
You can sure use the OOP paradigm in JavaScript the same way you can use any other and/or mix them all.

JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting procedural, object-oriented, imperative, and declarative (e.g. functional programming) styles.

On the other hand JavaScript's name and C-like syntax, including curly braces and the clunky for statement, makes it appear to be an ordinary procedural language. This is misleading because JavaScript has more in common with functional languages like Lisp or Scheme than with C or Java.

See the JavaScript Reference for more details on that.

Application of JavaScript

JavaScript can run wherever it is a JS RE (JavaScript Runtime Environment), this can be (Node, Deno, Bun...) or every single browser, a good example outside the web is using Node in a Raspberry Pi or Electron JS which make use of Node and Chromium to provide a RE for desktop Apps.

While it started as a narrow DSL (Domain Specific Language) it headed step by step to a general-purpose-like language.
It will never (probably) reach a general purpose equivalent to C (e.g. even you can find JavaScript Based OS concept, it still needs to rely on C and/or C++ behind the scenes to provide low-level APIs).

Hope it helps somehow, till the next time!

Collapse
 
kavyagreatrgb profile image
Kavya-RGB

The Following Changes which your described were made successfully, Again Thanks For Correcting Me.

Collapse
 
kavyagreatrgb profile image
Kavya-RGB

Thanks, I will look into my post and edit it.

Collapse
 
seneargroup profile image
seneargroup

Javascript is a object oriented programming language only except it doesn't not support polymorphism

Collapse
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

It is a prototype-based Object Oriented language from the language implementation point of view. It must not be confused with a pure OO language like SmallTalk as Js is not pure OO from any point of view.

JavaScript does support primitives (you don't want that in pure OO).
Also it doesn't implement polymorphism neither it has abstract classes, which are requirements for a language to apply a complete OO implementation.

Every single one of the following sentences is true from the core API point of view:

  • JS is an Object Oriented Language
  • JS is a procedural language
  • JS is a functional language
  • JS is an imperative language
  • JS is a declarative language

but they are inexact, because if you apply logic to those sentences each one can be exclusive (if it is an object oriented language, it cannot be another thing)

So to be more exact we say that JavaScript is a multi-paradigm language, which means that you can use any paradigm with it.

Because JS implements all of them (multi-paradigm), it is your project the one that will sit on one or more of those categories depending on your software design and implementation.

See the reference

Excerpt from the language reference:

JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.