Blog-javascript

Introduction
JavaScript, or JS as it is popularly known, is a well-known, adequately acknowledged, and standardized programming language. Yet, we’re reintroducing it. You may wonder why? Simply because JS is notorious for being the world’s most misunderstood programming language. Although it is often derided as a toy, beneath its layer of deceptive simplicity, powerful language features await. No wonder JS is now used by an incredible number of high-profile applications.
Unlike most programming languages, JS has no concept of input or output. Instead, it is designed to run as a scripting language in a host environment. In other words, it is up to the host environment to provide mechanisms for communicating with the outside world. The most common host environment is the browser, but JS interpreters can also be found in a huge list of other places.
The advent of a new generation of JS that is equipped with unique development skills and as a full stack has increased productivity and shortened the time-to-market for products.
In fact, JavaScript frameworks have raised the bar so high that it’s probably safe to say that a framework of some kind has now become the new baseline for the development of rich client applications. It would also not be too far removed from the truth to say that this phenomenon has helped build one of the largest ecosystems for mobile development.
Why is JavaScript the first choice?
JS is one of the most versatile and effective languages that developers can use. Survey results suggest that JS is used by a whopping 88% of all websites. In fact, JS is not only on every website but is also present on mobile sites, games and web applications.
A big difference between JS and other competing languages like RubyPython and / or Java is its ability to achieves concurrency (the simultaneous execution of several instruction sequences) through a programming model called the ‘event loop.’ When an event such as a mouse click or a mouse over occurs in the browser, the JS runtime stores a message in what is called a ‘message queue.’ If a callback function exists for the queued message, it is executed the next time it is encountered within the loop. In this way, events can trigger callback functions when a response is available sometime in the future. The end result is that a JS application is able to handle concurrent operations on a single thread. This frees the developer from the additional programming overhead incurred when managing the application state across multiple threads.
Let’s enumerate the advantages of using JS as follows:

  • It is able to run dynamic sites on any browser. This cross-browser support is made seamless with libraries like jQuery
  • JS works well (and fast) without requiring too much memory space. Some JS applications can even run without connecting back to a web server. This means they will work in a browser with, or without, an internet connection.
  • It moonlights as a server-side programming language via Node.js, a back-end framework that uses JS runtime to build data intensive apps (eg: anything real time, like a chat room)
  • It is easy to learn. JS can be learnt in a few weeks despite having evolved over its 19-year-old history. Compared with a language like C++, which can take years to learn and has numerous constructs, JS is a quick study
  • It pairs with Karma for excellent testing capabilities. Karma is a JS test runner that runs on Node.js and works well with any JS framework. It allows developers to get instant feedback on how the code they have written will perform
  • It is mobile flexible. JS has numerous extensions available for responsive mobile app development, including Bootstrap and jQuery Mobile. It is also the basis for React Native, Facebook’s mobile UI framework
  • JavaScript can be compiled from codes written in different languages through source-to-source compilers like CoffeeScript. With TypeScript, a compiler created by Microsoft, a high-level superset of JS (with the same JS syntax), is compiled into plain JS
  • It is more than just a script. Instead, it is a full-fledged programming language. For instance, Mozilla is written in JS

JavaScript Engines
JS is a high-level programming language which means it is readable, flexible and relatively easier to implement than a language like C. However, JS must be compiled to native machine code in order for your computer to read and execute it. Enter the JS engine, a virtual process machine designed to interpret, compile and execute JS code. It is a big part of the speed arms race between browsers, and is also used to power any technology that requires a virtual machine. For instance, Node.js and its role in server-side development. Mentioned below is a list of some of the more popular JS engines and the technologies they power:

  • JavaScript V8: Google Chrome, Opera, Node.js
  • SpiderMonkey: Mozilla Firefox
  • JavaScriptCore: Safari
  • Chakra: IE, Edge

In general, a JS engine provides everything it needs to run in a browser, thereby simultaneously functioning as an interpreter, a compiler, and a runtime environment.

JavaScript Frameworks

JS frameworks streamline more complicated commands into simple blocks of JS code, making programming faster and easier. Let’s take a quick look at a few of the most popular JS frameworks.

  • jQuery: The most popular JS library out there, this is the ‘write more, do less’ framework that makes JS behave the same irrespective of the difference in browsers.
  • ReactJS: This is Facebook’s JS library that is excellent for building web application UIs. React Native is the mobile library for building natively rendered mobile application UIs
  • AngularJS: Extremely robust, geared toward desktop apps, and perfect for data heavy sites, the AngularJS framework provides a great module-based structure for building complicated applications easily. It is all about simplification, extending HTML, and using the shortest code possible
  • js: A lightweight JS framework that is a pared-down alternative to more full-featured frameworks, this one is about minimalism. Backbone is used by sites like Airbnb and Pinterest
  • Bootstrap: A mobile-first framework, this uses HTML, CSS and JS to facilitate rapid responsive app development
  • js: Another lightweight JS framework, Ember has been used by sites like Groupon and Zendesk. It hinges on site performance and comes with a built-in data module and template engine. It works particularly well with Ruby on Rails, and is the best approach for developers familiar with object-oriented programminglanguages like Ruby, Python, C# and Java
  • Meteor JS: An open source, real-time framework, this was built on top of Node.js and works closely with MongoDB, a leading NoSQL open source database
  • js: A server-side development environment designed to use JS to build back-end applications, this has its own slew of frameworks, task runners and plugins
  • js: This server-side JS framework runs on the Node.js platform
  • js: This next generation framework for Node.js follows in Express’ footsteps
  • Prototype: A framework with a built-in API, this one makes common JS tasks more streamlined to code
  • MooTools: Another JS framework with an API, this one also streamlines common tasks but with a few extras, including effects and animation

Why is JavaScript so valuable?
A web developer can add personality to websites by using JS. Let’s understand how. JS is the native language of a browser. If you want to build single-page web apps, there is really only one language option for building client-side, single-page apps and that is JS.
Some popular sites that use JS include Google, Facebook, YouTube, Yahoo, Wikipedia, Amazon and Twitter. Interestingly, it is the most used language on GitHub.
There are also many web applications that avoid using HTML, and are coded entirely in JS. These include Gmail and most Google apps. In fact, Google is also executing JS on web pages to index them more accurately.
Similarly, Amazon has launched AWS SDK for JS in the browser. This lets developers write dynamic JS applications that can access AWS services from the browser without writing any server-side code(s), thereby configuring an application server for hosting.
Google too has pushed JS forward with their V8 JavaScript Engine. In fact, hardware can also now be programmed in JS. GitHub’s Atom Editor is built almost entirely around Coffee Script, which compiles to JS. The point to be note, however, is that JS is not a client-side scripting anymore, especially with the introduction of Node.js.
JavaScript everywhere architecture
javascript
Architecture built with JS as the core brings up the idea of using a single language on the client and the server sides, enabling the reuse of components and resources. Additionally, this enables the continuous building and unit testing of business logic and involved components.
Node.js completely changes the way I/O access is handled. So much so that everything runs in parallel except the code.
The best is yet to come
All the above points make one thing clear; that JS is here to stay. In fact, it is almost impossible that JS will be replaced by another language anytime soon. In fact, it can be said with a fair degree of surety that it will not only maintain, but also extend its hold on the World Wide Web.