Search results for "javascript"


Best Device Orientation API In Web Using Javascript

on September 28, 2020 πŸ”₯ 162751 views

In this tutorial, we see the hidden gem that is Detecting device orientation in Web Using Javascript. you need to make sure your browser supports it. You can easily check caniuse.com. Code & Demo Works Better in Mobile Detecting device orientation It allows a device to detect its physical orientation with respect to gravity. If […]

post

Answer for How to get and to update nested object values with the dot notation string using javascript

on September 25, 2020 πŸ”₯ 0 views

You can use this approach via passing the data as an internal object, filed to be updated, and value of the field. nestedObjectGetUpdate(data, field, value) { let schema = data; // a moving reference to internal objects within obj const pList = field.split(‘.’); const len = pList.length; for (var i = 0; i < len […]

discussion

How to get and to update nested object values with the dot notation string using javascript

on September 25, 2020 πŸ”₯ 0 views

Can anyone have a better solution to get and update nested object values with the dot notation string using javascript? I have an object say, let user = { “fullname”: { “firstname”: “abc” “lastname”: “xyz” } }; and I have a string with the dot notation which indicates what key needs to get or updated […]

discussion

Answer for What is the difference between async and defer in JavaScript

on September 25, 2020 πŸ”₯ 0 views

Async allows execution of scripts asynchronously and defer allows execution only after the whole document has been parsed. With async, the file gets downloaded asynchronously and then executed as soon as it’s downloaded. With defer, the file gets downloaded asynchronously but executed only when the document parsing is completed. Just note this will not affect […]

discussion

What is the difference between async and defer in JavaScript

on September 24, 2020 πŸ”₯ 0 views

What is the difference between async and defer in JavaScript? While we import the javascript file using script tag we use async or defer or just normal script tags what is the difference. // Normal Include <script src=”demo.js”></script> // Defer Include <script src=”demo.js” defer></script> // Async Include <script src=”demo.js” async></script>

discussion

Answer for How to merge two object and returned combined object using javascript

on September 24, 2020 πŸ”₯ 0 views

For Merging two different object you can do this /** * Merge Two objects and return combined object */ merge = (target, source) => { // Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties for (const key of Object.keys(source)) { if (source[key] instanceof Object) { if […]

discussion

How to merge two object and returned combined object using javascript

on September 23, 2020 πŸ”₯ 0 views

What is the best way to merge two object and return a combined one using javascript?

discussion

Best Way To Add and Remove CSS Class Using Javascript

on July 9, 2020 πŸ”₯ 28554 views

In this tutorial, we will see the different methods for To Add and Remove CSS Class Using Javascript by taking the reference of the element ID. Add or Appending CSS Class Using Javascript There are two possible ways to add or append the CSS class to the HTML element i.e via className and classList CSS […]

post

How To Use Import and Export In JavaScript

on May 21, 2020 πŸ”₯ 5569 views

In this tutorial, we will see how to use import and export in javascript. Due to one of the best features of the ES6 is the ability to import and export the javascript module. Before the ES6 we used to import module using require() function. Export in Javascript There are two different types of export […]

post

What Is Async-Await In JavaScript Explained

on August 4, 2018 πŸ”₯ 4921 views

What Is Async-Await In Javascript really means? As the name suggests when there is an async that means u need to wait. Why Do We Need To Wait? because javascript is non-blocking, by default it doesn’t wait for something to be executed. { // new situation console.log(“we should go in !”); // some msg console.log(“friend: […]

post