Object.entries It takes an object and returns an array of that object’s own enumerable string-keyed property [key, value] pairs. const person = { name: ‘Bruce’, age: 30, job: ‘Engineer’ }; const entries = Object.entries(person); console.log(entries); // Output: [[‘name’, ‘Bruce’], [‘age’, 30], [‘job’, ‘Engineer’]] Object.fromEntries Does the reverse of Object.entries.… Continue reading Object.entries and Object.fromEntries in JavaScript
Tag: JavasScript
reduce and reduceRight in JavaScript
reduce processes the array from left to right (starting from the first element and ending with the last element). const arr = [‘a’, ‘b’, ‘c’, ‘d’]; const result = arr.reduce((acc, curr) => acc + curr, ”); console.log(result); // Output: “abcd” reduceRight processes the array from right to left (starting from the last element and ending… Continue reading reduce and reduceRight in JavaScript
What is evented I/O for V8 JavaScript?
Evented I/O for V8 JavaScript is the core design principle behind Node.js, enabling non-blocking, asynchronous operations. It lets JavaScript code perform I/O operations without waiting for each to complete, which can make applications more efficient and performant. Understanding evented I/O Evented I/O is built around events and callbacks. When an I/O operation is initiated, it… Continue reading What is evented I/O for V8 JavaScript?
every() function in JavaScript
Executes a function for each array element. Returns true if the function returns true for all elements. Returns false if the function returns false for one element. Sample code Here log will be true because every element in the array satisfies the condition. If the value of array is [11,2,4,6,8], the output will be zero… Continue reading every() function in JavaScript
By using Javascript make an area of the image to zoom when hovered over the specific area of the image.
We can zoom the are of the image where the mouse is hovered on the image which will help in showing the zoomed product in the pdp page to the user.
How to create a draggable HTML element with JavaScript and CSS
Create a Draggable DIV Element Step 1) Add HTML: Example Code: <!– Draggable DIV –> <div id=”mydiv”> <!– Include a header DIV with the same name as the draggable DIV, followed by “header” –> <div id=”mydivheader”>Click here to move</div> <p>Move</p> <p>this</p> <p>DIV</p> </div> Step 2) Add CSS: The only important style is position: absolute, the rest is… Continue reading How to create a draggable HTML element with JavaScript and CSS