Secrets of Logical ️ Operators in Javascript 🤷‍

Learn how logical operators in Javascript is different from other programming languages (&& || !) Logical operations allow us to make decisions (either true or false ), based on conditions. In most programming languages, the logical operation returns either true or false. In Javascript, logical operations return the value of one of the operands used in …

First class Function in Javascript.

Learn about what is first class function and how to use it , in Javascript. A programming language is said to support First class function , if A function can be assigned to a variable, 2. A function can be passed as an argument, 3. A function can be returned from other function. A function can be …

Take screenshot 📱with Javascript .

Learn how to take screenshot with javascript . To use the webcam or microphone, we need to request permission.We can request the access using getUserMedia() function , The getUserMedia() function takes constraint as argument . The constraint object contains either you need to access webcam , audio, or both. If you want to access the webcam, the parameter should …

Check if your variable is an Array in Javascript.

Learn Different ways to check if a variable is array in Javascript. Using Array.isArray() Using toString() method in Object, this method convert the argument to specific type name, If we pass Object.prototype.toString.call(1) returns “[object Number]” , so if we pass array then it results in “[object Array]” . Using instanceof keyword arr instanceof Array; Using toString method …

How to insert element based on index in an array.

Learn how to insert an element in specified index of the array in Javascript. The splice() method changes the contents of an array by removing or replacing existing elements and/or adding new elements in-place(in original array). The splice method will take three argument → start , deleteCount(optional), items to add (optional) . In the above program we …

Three different ways to loop through JavaScript objects

Learn how to loop through objects in Javascript. var object = { name : “Javascript Jeep”, status : “😎”, icons : “🚗” } Using for..in With ES6, we can use Object.entries to loop through each entry of the object. The Object.entries method returns an array of [key, value]. We can also use Object.keys which will …

Creating notification bell 🔔 in javascript.

Learn how to create notification in Javascript. The Notification API allows you to create notification on the web page. To create notification first we need to change the notification default settings. Here change the Notification block to allow. So the notification will be displayed . To check for notification support in the browser , To check thr …

Enabling full screen in Javascript.

Learn how to enable full screen using Javascript. We can use requestFullscreen() method on any element to make the element as full screen. requestFullscreen() method makes an asynchronous request to make the element be displayed in full-screen mode. We can check if any other element is already in fullscreen mode by using document.fullscreenElement . To exit …

Generate random numbers in JavaScript using Crypto, without Math.rand()

Learn how to get a random number without using Math.rand() The Crypto.getRandomValues() method lets you get cryptographically strong random values. Syntax: getRandomValues(typedArray) Argument: typedArray → Is an integer-based TypedArray, which can be an Int8Array or an Uint8Array or an Int16Array or a Uint16Array or an Int32Array or a Uint32Array. All elements in the array are …

Design a site like this with WordPress.com
Get started