Shahzad Khan, Author at General Assembly Blog

What Makes JavaScript So Popular

By

Our lives today are dependent on the interactivity that JavaScript provides. If you want to really see how much you depend on it, you can disable JavaScript in your browser for a day. Some pages will load quicker, they’ll be cleaner, you’ll have less ads, no pop-ups, and the battery life of your computer may last longer. But also parts of the webpages simply will not work. Neither will Netflix, YouTube, Google Docs, Google Maps, and much more. We are, to a good degree, dependent on JavaScript to function. Today, virtually every computing device including iPhones, Android phones, MacOS, Windows, Linux, smart TVs, etc.. in the world have JavaScript interpreters installed on them and in active use.

There are over 1.8 Billion websites in the world, and JavaScript is used on 95% of them

The popularity of JavaScript over the years.

JavaScript is by far the most used language according to Github’s 2020 Octoverse Report.

So how did JavaScript get this big? Why did it get so popular? 

The creation story of JavaScript is the foundation of its popularity. 

It begins in the year 1995 at the Netscape headquarters, where young Brendan Eich goes into a ten day sprint of coding and comes out on the other side with a new language. Wow!

As more people used browsers to use and experience the internet, there was a need for a programming language that would give life to the browser. Something that went beyond HTML and CSS. That’s where JavaScript came in to give life to the browser. It’s a language that is capable of doing what all other programming languages do but also has a special relationship with the browser. It changed the way we thought about the internet and ushered a new era of browser based applications. 

Easy setup 

Unlike many other languages, where you need to go download the language in your machine in order to access all of its features and create a development environment, with JavaScript anyone with a web browser suddenly has a development environment right in front of them. Every browser supports JavaScript!  


You can simply open your browser, like Chrome, and navigate to Developer Tools, and start coding away! To write a “Hello World” program is as simple as: 

console.log(“Hello World”); 

You can also use an Integrated development environment (IDE) or code editor like Visual Studio Code where you can create a file with the file extension .js to write JavaScript. Visual Studio Code (VS Code) is more widely used to write code but there are other editors like Atom and Sublime Text which are quite common amongst developers.  

Event-based programming
One of the most impressive features of JavaScript is that it includes event-based programming. It has built-in events like ‘onClick’ and ‘onHover’ that wait for user interaction on a website before executing a specific segment of code. For instance, when you click the night-mode toggle, that is an event which triggers a JavaScript code segment that changes the CSS across the whole website from light colors to dark colors. 

JavaScript can be used to generate dynamic contents on a website as well. Different HTML tags can be generated based on user input. For instance, if you are on Facebook and you click into a comment box to type your comment on someone’s post, in that moment your click was an event that executed a code block in JavaScript that led to the generation of an HTML tag to display your comment.

End-to-end programming with Node.JS 

While JavaScript has been given the title of The Language of the Browser, in 2009 with the release of Node.JS, a runtime environment that runs JavaScript code outside a web browser changed the fate of the language. Node.JS lets developers use JavaScript to write server-side scripting. Consequently, JavaScript’s popularity was dramatically increased because Node.JS represents the idea of “JavaScript everywhere” paradigm, unifying all of web application development around a single programming language, rather having a different language for server-side and client-side scripts. 

In other words, now developers can use one single programming language to talk to databases, make HTTP requests, generate dynamic content, and create interactive user experiences/interfaces. This led to the Rise of Web Applications that we are experiencing today. In addition to having a unified web-application development, JavaScript also became the go-to language for many companies because now the engineering teams only had to worry about a single programming language which made it easier to debug and save costs in the overall development process. 

In 2013 AirBnb launched their site and became the first to utilize the full-stack JavaScript solution. This approach allowed for code to be executed on the server-side and rendered in the browser with subsequent actions being handled by the exact same code on the client side. This inspired several other companies to do the same and today we have products and services like LinkedIn, Netflix, Uber, PayPal, eBay, Groupon, GoDaddy, CitiBank and many more using Node.JS. 

JavaScript Libraries and Frameworks

The popularity of JavaScript led to the creation of several libraries and frameworks that have made application development efficient and performant. Today, libraries like React JS, jQuery, D3.js, etc.. are used in most applications across the world. Frameworks such as Angular, Ember JS, and Vue JS provide optimal performance and organization to build large applications. 

Active Community 

Amongst the programming languages, JavaScript has one of the largest communities according to Stackoverflow. In addition to that community, Node.JS has over a billion downloads across the world and is one the most widely used technologies. 

These are just a few of the reasons why JavaScript is so popular. With the change in paradigm that led to the rise of web applications, unifying the web application development, cross browser support, and the plethora of libraries/frameworks available, the world of the internet has been fully invested in the growth of JavaScript. Furthermore, since JavaScript is a high-level interpreted language that is easy to understand, it is the one of the best languages to learn if you want to enter the world of programming and explore the amazing possibilities of web-application development. 

Explore Coding Workshops

What is the power of JavaScript used for?

By

At a high level, JavaScript is a scripting or programming language that allows you to implement complex features on web pages such as displaying timely content updates, interactive maps, animations, etc. JavaScript is used for all web-related software development. It is the most widely used and popular programming language in the world for website building.

The power of JavaScript is in its popularity, ease of use, and large community. It is one of the three core technologies of the World Wide Web (www), alongside HTML and CSS. Perhaps the most powerful thing about JavaScript is that it includes all of the features of a programming language embedded in your browser. Unlike other programming languages, where you have to download the language in your machine and create an environment, JavaScript does not require that. If you have a web browser like Chrome, then you can write JavaScript.

Originally, JavaScript was only on the client side of programming to create user interfaces and webpages’ interactivity. With the development of Node.js, JavaScript is not used in both client-side and server-side programming. This makes it extremely versatile and valuable.

JavaScript is the standard programming language of the web, and everybody uses the software written in JavaScript. Virtually everyone who has an internet-connected device with a screen can use applications written in JavaScript.

Popular Uses of JavaScript

Adding Interactive behavior to web pages: 

  • Show or hide information on a click event. 
  • Change colors of a button when the mouse hovers over it.
  • Slide through a carousel of images. 
  • Zooming in and out on an image.
  • Display a timer or a countdown on websites. 
  • Play audio. 
  • Embed video. 
  • Display animations and visual effects.
  • Creating pop-ups and modals 
  • Using a dropdown hamburger menu 
  • Client-side form validation.
  • Autocompletion.

Creating web and mobile applications:

  • Developers have access to a plethora of JavaScript frameworks for developing and building web and mobile apps. JavaScript frameworks are collections of JavaScript code libraries that provide developers with pre-written code to use for routine programming tasks. 
  • Popular front-end JavaScript frameworks include React, React Native, Angular, Vue, and Ember.js. 

Building web servers and developing server applications:

  • Node.js is a JavaScript runtime environment that allows developers to write server-side JavaScript to build servers and connect with databases. Frameworks like Express.js allow developers to build robust servers and develop back-end infrastructure using Node.js

JavaScript is the backbone of modern web applications, but much like the human spine, it is quite flexible and liberal in what it allows. This can sometimes be seen as a disadvantage because it makes finding problems in programs harder. But this flexibility allows developers to use many techniques that are not possible in more rigid programming languages.

A superpower of JavaScript is that it is easy to learn. It is widespread and supported by all browsers. Because it is a high-level language, it takes care of a lot of nitty-gritty programming for you, whereas in other low-level languages, you have to think about memory management, etc. In addition to being easy to learn, it is also easy to use. As long as you have a browser, you can write JavaScript to create rich web content.

Every programming language has some feature that separates it from other languages. In addition to all the amazing features of JavaScript, the one that stands out is how functions work in the language.

“Functions are the very best part of JavaScript. It’s where most of the power and the beauty of this language is.” — Douglas Crockford

Functions in JavaScript can be seen as workhorses. They alone play roles that other languages fulfill with multiple distinct features like procedures, methods, constructors, classes, and modules. All of these can be covered by the versatility of functions in JavaScript.

Finally, the most powerful feature of JavaScript is its community. It has one of the largest communities for any programming language. It is consistently ranked highest in Stackoverflow, Google searches, and GitHub issues. The amount of support for beginners is amazing!

Explore Coding Workshops

What is a JavaScript library?

By

JavaScript is one of the most widely used programming languages in the world. It’s a scripting language used by developers to create interactive user interfaces that display dynamic content. It is given the title of The Language of the Web Browser because it is the most commonly used language to build web applications and works well across all web browsers

As the popularity of JavaScript increased and more people were using it to build websites and applications, the JavaScript community recognized that certain patterns in the code were being used repeatedly to accomplish the same tasks. This re-writing of code and recognizing that certain JS functions need to be implemented multiple times led to the development of JavaScript libraries and frameworks. For instance, reoccurring animations, interactive forms that appear in different places on a website or app, etc.. were repetitive tasks that could automate by having a code snippet utilized as needed without writing code every time.

Generally speaking, JavaScript libraries are collections of prewritten code snippets that can be used and reused to perform common JavaScript functions. A particular JavaScript library code can be plugged into the rest of your project’s code on an as-needed basis. This led to faster development and fewer vulnerabilities to have errors.

jQuery 

There are a plethora of libraries and frameworks available to JavaScript developers today, but the concept of a JavaScript library was initiated with the creation of jQuery. jQuery is a JavaScript library designed to simplify HTML DOM (Data Object Model) manipulation and event handling, CSS animations, and Ajax. At the time, jQuery shortened the syntax and simplified the code, making it easy to understand and increased developer productivity. 

All a developer had to do was install jQuery and use prewritten code snippets to manipulate the DOM. For example, if a developer wants to add an autocomplete feature in a search bar on their site, they would insert the appropriate jQuery code snippet into the project’s code. When a user enters text into the search bar, the jQuery code snippet retrieves the feature from the jQuery library and displays it in the user’s web browser. 

React JS

In 2011, Facebook created a JavaScript library called React, which specializes in helping developers build user interfaces or UI’s. React is a component-based library that helps developers design simple views for each state of the application. React is also extremely smart in that it does a lot of heavy lifting in terms of efficiently updating and rendering the right components when there is a change in data or the state in the application. Today, React is the most popular JavaScript library, and companies use it all over the world like Uber, Airbnb, Facebook, Netflix, Instagram, Amazon, Twitter, and much more. 

The component-based library allows developers to avoid the pitfalls of rewriting code and dealing with complicated debugging. With React, you can reuse and recycle different components across the web application or other products. Components such as navigation bars, buttons, cards, forms, sections, etc., can all be reused like little building blocks that make the application. A library like React dramatically increases the development speed with fewer bugs and makes extremely performant applications. 

Library vs. Framework 

Perhaps one of the most common topics of discussion in the software community is the difference between a library and a framework. As we see above, jQuery and React are libraries with prewritten code snippets that we can use and reuse to build applications. So while JavaScript libraries are a specialized tool for on-demand use, JavaScript frameworks are a full toolset that helps shape and organize your website or application. In other words, libraries are about using what is needed for the task, while frameworks provide you with all the tools you could need even if you don’t particularly need all of them. 

Think of it like cooking some pasta. When using a JavaScript library, you simply grab the pot, pan, ingredients to make the pasta, and plates to serve. You only require only the things you need to make pasta. When thinking about a JavaScript framework, imagine an entire fully loaded kitchen. Another way to think about it can be that JavaScript libraries are like pieces of furniture that add style and function to an already constructed house. At the same time, frameworks are templates you can use to build the house itself. 
Examples of some JavaScript frameworks include Angular, Ember JS, and Vue JS. These are some of the most popular frameworks with large communities and support systems. Frameworks provide a structure to base your entire application around, and developers can safely work within the structure’s rules. The advantage of frameworks is the overall efficiency and organization. The disadvantage is that a developer has less freedom to work around the rules and conventions specific to a particular framework. Libraries, on the other hand, give developers more freedom to use different code and snippets but do not provide the type of structure and convention that comes with a framework.

Explore Coding Workshops

What is a JavaScript framework?

By

A JavaScript framework is a collection of JavaScript code libraries that provide developers with pre-written code for routine programming tasks. Frameworks are structures with a particular context and help you create web applications within that context. 

It is completely possible to build strong web applications without JavaScript frameworks, but frameworks provide a template that handles common programming patterns. Each time you have to build an application, you don’t need to write code for every single feature from scratch. Instead, you can build upon an existing feature set. 

JavaScript frameworks, like most other frameworks, provide some rules and guidelines. Using these rules and guidelines, any developer can make complex applications faster and more efficiently than if they decided to build from scratch. The rules and guidelines help shape and organize your website or web application too! For example, think about a potter’s wheel where you can build pots. The potter’s wheel is your framework; it has certain consistencies that you have to work with. The wheel rotates, and you can use that rotation to build pots of different shapes and sizes. You can build pots, plates, cups, bowls, or even cylindrical sculptures. But you can’t build a house with it; you need to find a different framework for that. 

Framework vs. Library 

A common topic of discussion in the software community is the difference between a framework and a library. In truth, experts have suggested that the line between them can be blurry, but it is useful to make the distinction — as a matter of conversation. While a framework is a full toolset that helps shape and organize your website or application, a library, on the other hand, is a collection of pre-written code snippets that are less about shaping your application and more about providing a use-as-needed library of features. 

Model View Controller (MVC) 

Modern JavaScript frameworks use a software design pattern called Model–View–Controller. It is commonly used for developing user interfaces that divide related programming logic into three interconnected elements. The model is the central component of the pattern as it is the application’s dynamic data structure. It manages the data of the application. The view consists of all the code that has to do with representing the application’s data — the code for the user interface. The controller is the interpreter. It accepts inputs and converts them into commands for the model or view. Frameworks are built around the MVC design pattern to provide structure and adaptability in software development. 

Popular JavaScript Frameworks 

JavaScript is one of the most popular and widely used programming languages globally and has more frameworks than any other language. Since JavaScript is used for both client-side and server-side code, there are many frameworks to work with. Some of the most popular frameworks include: 

 Front-End Frameworks

React

React.js is an efficient and flexible JavaScript library for building user interfaces created by Facebook. Technically, React is a library, but it is often discussed as a framework and is compared to other frameworks. React makes it easy to create interactive user interfaces because it has predictable code that is easy to debug. Furthermore, it provides a component system where blocks of code can be written once and reused repeatedly in different parts of the application or even other applications. 

Angular

AngularJS is a popular enterprise-level JavaScript framework used for developing large and complex business applications. It is an open-source framework created by Google and supported by both Google and Microsoft. 

Vue 

Vue.js is a progressive framework for building user interfaces. It is an up-and-coming framework that helps developers in integrating with other libraries and existing projects. It has an ecosystem of libraries that allow developers to create complex and solid single-page applications. 

Back-End Frameworks

Express 

Express.js is a flexible, minimalistic, lightweight, and well-supported framework for Node.js applications. It is likely the most popular framework for server-side Node.js applications. Express provides a wide range of HTTP utilities, as well as high-performance speed. It is great for developing simple applications that can handle multiple requests at the same time. 

Next.js

Next.js is a minimalistic framework that allows developers to create a server-side rendering and static web applications using React.js. It is one of the newer and hottest frameworks that takes pride in its ease of use. Many of the problems developers experience while building applications using React.js are solved using Next.js. It has many important features included “out of the box,” and makes development a breeze. 

In the current job market, the most popular framework/library is React.js. Since JavaScript has so many frameworks, it can sometimes be hard to decide which one to start learning. You could start with any framework, but if your goal is to get a job, you will have better odds if you learn React first. The same can be said for Express.js as a back-end framework as it is the most widely used and sought-after framework. 

JavaScript frameworks are more adaptable for designing web applications and make working with JavaScript easier and smoother. This is why they are so popular amongst developers. A variety of frameworks exist because they can be applied to solve different problems. When choosing a framework, carefully consider your project requirements before deciding to implement any particular JavaScript framework. In addition to all the unique technical features of JavaScript frameworks, each framework comes with its own learning curve, community engagement/support, documentation, and compatibility. 

Explore Coding Workshops