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 …
Tag Archives: javascript
Cheatsheet for if Statement in Javascript .
Learn the every behaviour of if statement of different values, Learn about unknown things about ** operator here. If you find this helpful surprise 🎁 me here. Share if you feel happy 😃 😆 🙂 . Follow Javascript Jeep🚙 if you feel worthy.
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 …
Continue reading “Check if your variable is an Array in Javascript.”
Exponentiation ** operator in Javascript
The ** operator returns the result of the first variable to the power of the second variable. That is, Math.pow(a,b). Photo by Crissy Jarvis on Unsplash var a = 2;var b = 5; a ** b; // 32 Math.pow(a, b); // 32 If we do like a ** b ** c , then the operation is computed …
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 …
Continue reading “How to insert element based on index in an array.”
Create beautiful boxes using the outline CSS property
outline is a line outside the border of a container. Let’s create a simple rectangle and apply an outline and see how cool 😎 it is. The syntx for ourline is outline: size type color; The above code will create a beautiful frame 🖼 . The available values are outline: auto → Permits the user agent …
Continue reading “Create beautiful boxes using the outline CSS property”
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 …
Continue reading “Three different ways to loop through JavaScript objects”
String methods : startsWith in Javascript.
Learn about the startsWith method of string object in Javascript. The startsWith() method returns true if the given characters are found at the beginning of the string, otherwise, false. If you want this method to be non case-sensitive then we can write a custom function We can also specify the position from which to begin …
Continue reading “String methods : startsWith in Javascript.”
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 …
Continue reading “Creating notification bell 🔔 in javascript.”
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 …