What is Vanilla JavaScript Or Pure javascript?

Updated on ... 18th November 2022

Vanilla JavaScript is nothing but pure JavaScript (or we can say plain JavaScript) without any type of additional library. People often used it as a joke "in modern web applications several things can also be done without using any additional JavaScript libraries".

Vanilla JavaScript is one of the most lightweight frameworks ever. It is a very basic and straightforward scripting language to learn and use it.

JavaScript scripting programming language that comes into use in 1995 and is at the core of the modern World Wide Web. HTML takes care of the content and structure of a page and CSS of the styling of the page and JS is used on the client side for the behavior or user functionality of a web page.

What can do Vanilla JavaScript:

  • It provides ajax functionality so that we can also fetch the data from the server by sending the Asynchronous or synchronous request to the backend language and receiving it.
  • Auto-update content, like a social media feed
  • Animate visual or frontend  elements
  • Add visual feedback on user interactions
  • Trigger pop-ups/offers after user actions 
  • We can add interactive maps etc.
  • we can create complete shopping cart solutions
  • Complete full-stack web apps
  • we can develop mobile apps (with React Native or Ionic)
What is Vanilla JavaScript Or Pure javascript?

A Vanilla Javascript basic example.


                                                    

                                                    

                                                    <!DOCTYPE html>
<html>
<body>

<h2>My First JavaScript</h2>
<button type="button"
onclick="document.getElementById('demo').innerHTML = Date()">
Click me to display Date and Time.</button>
<p id="demo"></p>

</body>
</html>

                                                    

                                                

Why learn JavaScript?

Well, this is the very common question that comes into every developer's mind in the starting when we start programming, while there are already so many other powerful frameworks and javascript libraries available that are easy to use, why we should choose to learn vanilla Js and use it in our web application.

There are many reasons for choosing vanilla javascript to learn and use it in our web application. 

As we probably already observed, JavaScript is a powerful programming language and very fast and easy to learn as compared to other languages.

Here we are discussing the following main and most important reasons that make javascript perfect to learn and use it.

a. Highly in demand

Nowadays growing online businesses we all need to make fast-loading websites and all new frameworks use javascript so 75% of IT companies are looking for JavasScript web developers nowadays.

b. Free to learn

There are a lot of free resources to learn javascript. From books, blog tutorials, and videos, you can learn the way that suits you most.

c. Web-performance

Javascript is much better for web performance as compared to many other frameworks and libraries, as it is the most important part of the front-end development and there is no need for any additional libraries to run javascript so that using less size of the file we can create a web application, hence it will load fast.

d. User Experience

Javascript provides a user-friendly developing experience. When starts developing an application or website using JavaScript, there is no need to include any libraries or no need to install any dependencies. We just need to open the text editor and can start coding. In case, if we still want to use any of the other libraries or frameworks it will work fine with them


e. fast loading:-

Javascript execution occurs on the client side there is no need compiler to run because all modern browsers inbuilt javascript rendered engines for example 

  • Google Chrome uses V8,
  • Mozilla Firefox uses SpiderMonkey,
  • Safari uses Nitro
  • Edge uses Chakra, etc.

it does not require any kind of external resources so its speed is excellent.

Disadvantages of the Vanilla Script

As all programming languages have some disadvantages same in vanilla javascript also has some disadvantages, as mentioned below:

  • One of the most disadvantages of the vanilla script is the client-side security, As we all know that the code of JavaScript is viewable on the client-side browser. So that anyone can modify it and use it as a weapon or tool for malicious purposes while we use form validation so in this case, we have to use both validation client-side validation and server-side validation to prevent these facilities.
  • JavaScript has another major disadvantage it lacks Debugging Facility.
  • We cannot use it for network-based applications because there is no such kind of support available.


Related Post

Leave a comment