{"id":28341,"date":"2022-03-07T10:51:08","date_gmt":"2022-03-07T10:51:08","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=28341"},"modified":"2022-12-23T06:48:05","modified_gmt":"2022-12-23T06:48:05","slug":"what-is-javascript-and-how-it-works-an-overview-and-its-use-cases","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/what-is-javascript-and-how-it-works-an-overview-and-its-use-cases\/","title":{"rendered":"What is JavaScript and How it works? An Overview and Its Use Cases"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">What is JavaScript ?<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"300\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/js1.png\" alt=\"\" class=\"wp-image-28348\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/js1.png 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/js1-300x117.png 300w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<p>JavaScript is\u00a0<strong>a dynamic programming language that&#8217;s used for web development, in web applications, for game development, and lots more<\/strong>. It allows you to implement dynamic features on web pages that cannot be done with only HTML and CSS.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why it is used?<\/h2>\n\n\n\n<p>HTML and CSS are languages that give structure and style to web pages, JavaScript gives web pages interactive elements that engage a user.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">History of JavaScript<\/h2>\n\n\n\n<p>JavaScript was originally developed by Brendan Eich of Netscape Communications Corporation under the name\u00a0<em>Mocha<\/em>, then\u00a0<em>LiveScript<\/em>, and finally renamed to JavaScript. The change of name from LiveScript to JavaScript roughly coincided with Netscape adding support for Java technology in its Netscape Navigator web browser. JavaScript was first introduced and deployed in the Netscape browser version 2.0B3 in December of 1995. When JavaScript was added to Internet Explorer, it had to be officially called &#8220;JScript&#8221;, because Netscape owns the name &#8220;JavaScript&#8221;. The choice of name proved to be a source of much confusion.<\/p>\n\n\n\n<p>The latest version of the language is ECMAScript 2018 which was released in June 2018.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Does JavaScript Work?<\/h2>\n\n\n\n<p>There are two important pieces to learn about: How the web browser works, and the Document Object Model (DOM).<\/p>\n\n\n\n<p>The web browser loads a web page, parses the HTML, and creates what is known as a Document Object Model (DOM) from the contents. The DOM presents a live view of the web page to your JavaScript code.<\/p>\n\n\n\n<p>The browser will then grab everything linked to the HTML, like images and CSS files. The CSS information comes from the CSS parser.<\/p>\n\n\n\n<p>The HTML and CSS are put together by the DOM to create the web page first. Then, the browsers&#8217; JavaScript engine loads JavaScript files and inline code but does not run the code immediately. It waits for the HTML and CSS to finish loading.<\/p>\n\n\n\n<p>Once this is done, the JavaScript is executed in the order the code is written. This results in the DOM being updated by JavaScript code and rendered by the browser.<\/p>\n\n\n\n<p>The order here is important. If the JavaScript did not wait for the HTML and CSS to finish, it would not be able to change the DOM elements.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\"  id=\"_ytid_81016\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/hKB-YGF14SY?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  epyt-is-override  no-lazyload\" title=\"YouTube player\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-can-i-do-with-javascript\">What Can I Do With JavaScript?<\/h2>\n\n\n\n<p>JavaScript is a full-fledged programming language that can do most things a regular language like Python can do. These include:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Declaring variables.<\/li><li>Storing and retrieving values.<\/li><li>Defining and invoking functions, including arrow functions.<\/li><li>Defining JavaScript objects and classes.<\/li><li>Loading and using external modules.<\/li><li>Writing event handlers that respond to click events.<\/li><li>Writing server code.<\/li><li>And much more.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"763\" height=\"390\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/js2.png\" alt=\"\" class=\"wp-image-28349\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/js2.png 763w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/js2-300x153.png 300w\" sizes=\"auto, (max-width: 763px) 100vw, 763px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"markdown-WhatIsJavaScriptUsedFor\">What Is JavaScript Used For?<\/h2>\n\n\n\n<p>The primary\u00a0use of JavaScript\u00a0is to build web-based applications. Some of what JavaScript can do for the web includes:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>adding interactive behavior to web pages like zooming in and out or playing audio\/video<\/li><li>creating web and\u00a0mobile apps, the most popular examples consist of the likes of Netflix and Uber<\/li><li>building web servers and server-side applications using Node.js<\/li><li>create games that operate inside the browser<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"630\" height=\"327\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/js3-2.jpg\" alt=\"\" class=\"wp-image-28350\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/js3-2.jpg 630w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/js3-2-300x156.jpg 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"markdown-ExamplesofJavaScriptApplications\">5 Examples of JavaScript Applications<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/lgnC1unL2nZagsysl5KPsM4olFk7pQpoAhlfKI1uyJjLJf414NL6QVRwXwXdywKu_6dl8yIiDMcRUP-WfXx_RdsA3vGxSUSXLj_ADYQVa2dJpiJo_mSPDW0F0GeJVn2HFVkcz8ha\" alt=\"\" \/><figcaption>JavaScript has several different frameworks for developing web and mobile apps<\/figcaption><\/figure>\n\n\n\n<p>To gain a better understanding of what JavaScript is used for and how to implement it into your business here are some more details on just what JavaScript can do.\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Web &amp; Mobile Apps<\/h3>\n\n\n\n<p>JavaScript has several different frameworks for developing web and mobile apps including React Native,\u00a0Ionic, and Angular. All these frameworks extend tooling to simplify development depending on what JavaScript is used for in each specific framework.\u00a0<\/p>\n\n\n\n<p>Facebook is<\/p>\n\n\n\n<p>Facebook is one popular company that uses JavaScript\u00a0to power its online community.\u00a0React\u00a0and the corresponding\u00a0React Native\u00a0are two\u00a0JavaScript frameworks\u00a0built by Facebook.\u00a0<\/p>\n\n\n\n<p>\u00a0to power its online community.\u00a0React\u00a0and the corresponding\u00a0React Native\u00a0are two\u00a0JavaScript frameworks\u00a0built by Facebook.\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Game Development&nbsp;<\/h3>\n\n\n\n<p>JavaScript can be utilized to develop games for web browsers. GitHub features a\u00a0collection of game engines, many of them employing HTML5 as well.\u00a0<\/p>\n\n\n\n<p>JavaScript is even being used in the\u00a0virtual reality industry, with the help of the WebXR Device API.\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Server Applications<\/h3>\n\n\n\n<p>Server-side scripting carries the imminent advantage of allowing content to load without the concern for browser capacity. Decreased load times can lead to such things as improved SEO and more customer satisfaction.&nbsp;<\/p>\n\n\n\n<p>This is yet another example of what JavaScript is used for. Using JavaScript\u2019s runtime environment,\u00a0Node.js, developers can create\u00a0server-side applications.\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Interactive UX<\/h3>\n\n\n\n<p>The most common example describing what JavaScript is used for involves delivering an interactive user experience (UX). JavaScript is a paramount technology for\u00a0front-end development.\u00a0<\/p>\n\n\n\n<p>You can thank JavaScript for the way you navigate the web by using a drop-down arrow to scroll to the bottom of a page.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. AI &amp; Machine Learning Projects<\/h3>\n\n\n\n<p>JavaScript has the libraries to support development for\u00a0AI-related projects\u00a0as well. Tensorflow.js, for instance, is a JavaScript library for machine learning. You can build and train machine learning models using the library.\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is JavaScript ? JavaScript is\u00a0a dynamic programming language that&#8217;s used for web development, in web applications, for game development, and lots more. It allows you to implement dynamic features on web pages that cannot be done with only HTML and CSS. Why it is used? HTML and CSS are languages that give structure and&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-28341","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/28341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=28341"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/28341\/revisions"}],"predecessor-version":[{"id":28351,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/28341\/revisions\/28351"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=28341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=28341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=28341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}