JavaScript Introduction

JavaScript (JS) is a lightweight interpreted (or just-in-time compiled) programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.

Data

JavaScript is not a compiled language, but it is a translated language. The JavaScript Translator (embedded in the browser) is responsible for translating the JavaScript code for the web browser.

Variables

Data

Keywords

Data

Conditional Statements

Data

Data

Function declarations
                Demo :

                function calcRectArea(width, height) {
                    return width * height;
                  }
                  
                  console.log(calcRectArea(5, 6));
                  // Expected output: 30
            
                Syntax:

                function name(param0) {
                    statements
                  }
                  function name(param0, param1) {
                    statements
                  }
                  function name(param0, param1, /* … ,*/ paramN) {
                    statements
                  }
            
Javascript and Java

lorem -n 50 lorem ipsum dolor sit amet consetetur sadipscing elitr sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat sed diam voluptua at vero eos et accusam et justo duo dolores et ea rebum stet clita kasd gubergren no sea takimata sanctus est lorem ipsum dolor sit amet

Arrays

lorem -n 50 lorem ipsum dolor sit amet consetetur sadipscing elitr sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat sed diam voluptua at vero eos et accusam et justo duo dolores et ea rebum stet clita kasd gubergren no sea takimata sanctus est lorem ipsum dolor sit amet

Nested Arrays

lorem -n 50 lorem ipsum dolor sit amet consetetur sadipscing elitr sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat sed diam voluptua at vero eos et accusam et justo duo dolores et ea rebum stet clita kasd gubergren no sea takimata sanctus est lorem ipsum dolor sit amet

Objects

lorem -n 50 lorem ipsum dolor sit amet consetetur sadipscing elitr sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat sed diam voluptua at vero eos et accusam et justo duo dolores et ea rebum stet clita kasd gubergren no sea takimata sanctus est lorem ipsum dolor sit amet

lorem -n 50 lorem ipsum dolor sit amet consetetur sadipscing elitr sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat sed diam voluptua at vero eos et accusam et justo duo dolores et ea rebum stet clita kasd gubergren no sea takimata sanctus est lorem ipsum dolor sit amet

lorem -n 50 lorem ipsum dolor sit amet consetetur sadipscing elitr sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat sed diam voluptua at vero eos et accusam et justo duo dolores et ea rebum stet clita kasd gubergren no sea takimata sanctus est lorem ipsum dolor sit amet

                creating new object :

                const o = new Object();
                o.foo = 42;
                
                console.log(o);
                // { foo: 42 }
            
Nested Objects
                    let x = "";
            const myObj = {
            name: "John",
            age: 30,
            cars: [
                {name:"Ford", models:["Fiesta", "Focus", "Mustang"]},
                {name:"BMW", models:["320", "X3", "X5"]},
                {name:"Fiat", models:["500", "Panda"]}
            ]
            }