Learnitweb

Category: JavaScript tutorial

  • const in JavaScript

    1. Introduction In this tutorial, we’ll discuss another way of declaring block-scoped constants – const. A const is similar to let with respect to scope. A const is block-scoped and can not be redeclared or reassigned a new value once declared or initialized. When you use a const to hold an array or an object…

  • let in JavaScript

    1. Introduction In this tutorial, we’ll discuss another way for declaring variables in JavaScript. First we have to discuss the problem with var which lead to the need of let. In this code, x is changed in the if block and it overrides the value of x declared outside the if block. To overcome such…

  • var in JavaScript

    1. Introduction var allows you to declare a globally-scoped or function-scoped variable. You can initialize a var variable when you declare it but it is optional. You can declare and initialize the variable in the same statement. You can do declare and initialize two variables in the same line. You can assign same value to…

  • Immediately-invoked Function Expressions (IIFE) In JavaScript

    1. Introduction An IIFE (Immediately Invoked Function Expression) is a JavaScript function that runs as soon as it is defined. An IIFE looks like the following: Let us understand IIFE with the help of an example. In the above code: there is no name of the function, it is an anonymous function. anonymous function is…

  • Hoisting in JavaScript

    1. Introduction In this tutorial, you’ll learn about hoisting in JavaScript. Hoisting is a very important concept to know for the JavaScript interviews. Hoisting is most commonly asked question in JavaScript interviews. We’ll discuss hoisting with respect to variable, function and classes. In JavaScript, variables and functions can be accessed before their actual declaration, and…

  • JavaScript versions

    In the early days of the Web, as the browser wars between Netscape and Microsoft heated up, Ecma International, formerly the European Computer Manufacturers Association (ECMA), agreed to take on JavaScript as a standard. Because of Sun’s ownership of the JavaScript name, ECMA adopted ECMAScript as the official name. However, virtually everyone uses JavaScript. As…

  • Introduction to JavaScript

    JavaScript is the programming language of the Web. Alongside HTML and CSS, JavaScript is one of the core technologies of the World Wide Web. JavaScript is dynamic, high-level, untyped interpreted language. JavaScript has object oriented and functional features as well. JavaScript was created at Netscape. The programs written in JavaScript can run on browser. Today,…

  • Features of JavaScript

    JavaScript is prototype based object oriented scripting language. Functions are used as object constructors. JavaScript is dynamically typed scripting language. JavaScript supports run-time evaluation. JavaScript has features of functional programming. A function is a first-class in JavaScript. JavaScript supports implicit and explicit delegation. JavaScript supports regular expressions. JavaScript does not provide many features of its…

  • strict mode in JavaScript

    JavaScript was developed over the years and several versions came but backward compatibility was maintained. The downside of this approach is that all imperfect language constructs remained there in language over the years. In ECMAScript 5, there were some major changes done to the existing language features. To maintain backward compatibility, these features are off…

  • Data types in JavaScript

    The latest ECMAScript standard defines eight data types: Seven primitive data types: Boolean: Boolean represents a logical entity and can have two values: true, and false. Null: The Null type has exactly one value: null. Undefined: A variable that has not been assigned a value has the value undefined. Number: The Number type is a…