Learnitweb

Author: Editorial Team

  • null in JavaScript

    1. Introduction null in JavaScript is an object which represents the intentional absence of value. null is a primitive value in JavaScript. null is treated as falsy for boolean operations. null is different from undefined which also means absence of value. Variables which are declared but not assigned any value are initialized to default value…

  • undefined in JavaScript

    1. Introduction In this tutorial, we’ll discuss undefined in JavaScript. This concept is little bit different from other popular languages like Java. In Java null is used to show absence of value. In JavaScript, people are confused about null and undefined as both look like absence of value. In this tutorial, we’ll try to explain…

  • Semaphore in Java

    1. Introduction The concept of a semaphore was introduced by Edsger Dijkstra in 1965 and was used for the first time in the THEOS operating system. The semaphore mechanism is used to control the access to one or more shared resources. The java.util.Semaphore class represents a counting semaphore which is initialized with a number of…

  • BlockingQueue in Java

    1. Introduction In this tutorial we’ll discuss BlockingQueue interface which is defined in java.util.concurrent package. BlockingQueue is a subinterface of java.util.Queue that also supports blocking operations that wait for the queue to become nonempty before retrieving an element and wait for space to become available in the queue before storing an element. BlockingQueue is typically…

  • Symbol in JavaScript

    1. Introduction In this tutorial, we’ll discuss in detail about a primitive type introduced in ECMAScript 6 – Symbol. The JavaScript already had five primitive types: string, number, boolean, null, and undefined before Symbol was introduced. In this tutorial, we’ll discuss Symbol and how to create a Symbol. We’ll also discuss about Symbol properties. But…

  • Destructuring assignment in JavaScript

    1. Introduction While working with arrays and objects sometimes we need to pull out values and assign it to distinct variables. The destructuring syntax makes it easy to do this with less code. Without destructuring it may require duplicate code. For example: You can observe, there will be repetitive code if there are more properties.…

  • 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…