1console.log("hello-world);
console.log("hello-world);
.container {
width: 80%;
}
<pre><code class="language-css">
.container {
width: 80%;
}
</code></pre>
In this blog you will understand how to efficiently add key/value pairs to a Javascript Map, common errors, and a fun coding problem to polish your skills.
When working with a Map in JavaScript, you might need to calculate the sum of all values. In this guide, lets explore the various ways to do so.
Welcome, fellow coders! In this blog, we’ll see how to check if an Object is a Map or a Set in JS. Shall we?
Today we dive deep into the art of clearing objects in JavaScript. This comprehensive guide will cover different property types (inherited, enumerable), various techniques for effectively resetting or clearing JavaScript objects, including simple objects, nested objects, and those with non-enumerable properties, and immutability. We’ll also address common pitfalls, best practices and a nice Practice Question to cement the concepts.
In this blogpost, we’ll be exploring the various methods to count array elements that match a specific condition. We’ll progress through different counting and iterating techniques – from traditional loops to modern ES6 features – highlight common pitfalls along the way, and end with a practice question to wrap up our understanding. So, grab a cup of coffee and dive in! 👨💻
Welcome, fellow coders! In this blog, we’ll see how to convert a map to JSON in JS. Shall we?
Use: Object.fromEntries(), map.forEach, for...of loop. Optimise using Chunking, Lazy Loading, Nesting, Web Workers. And a Practice Qn.
Convert Null Undefined NaN to 0 in JavaScript: Use Nullish coalescing, === vs ==, isNan(), Number function, common tips, and a Practice Qn.
Using Array.from(), forEach(), reduce(), 2 dimensional Array, Proxy Lazy Evaluation, Converting Nested Array to Map, and a Practice Qn.
Using Object.entries, keys, hasOwnProperty, getOwnPropertyNames, getOwnPropertySymbols, Reflect.ownKeys. Learn errors & a Practice Qn.
Use: Array.from, Spread syntax, Set inside Object to JSON, JSON to set, Circular References, Chunking large Sets, Nesting issues & a Practice Qn.
Learn 9 ways to avoid TypeError when using in operator JavaScript. Learn common mistakes when using `in` , and do a Practice Qn.
Using String.split(), String.trim(), Array.shift(), String.slice(), String.indexOf(), String.prototype.match(), String.prototype.charAt(), & Regex.
Get first and last digits in Javascript using Modulo, String methods, Loops, recursion, Regex and BigInt functions. Learn tips and do a Practice Qn.
Welcome, fellow coders! In this blog, we’ll see how to extract the first N characters from a string. Whether you’re a beginner or just looking for a quick refresher, we’ve got you covered.
See various techniques, from arrays to objects, manual additions to replications.
In JavaScript, zipping two or more arrays refers to the process of combining their elements into pairs. This guide will take you through various methods to achieve this.
Using Map, forEach, for loop, ES6 Spread & Arrow, Recurse nested Arrays, & Multidimensional Arrays. Checking Data type & a Practice Qn.
Dealing with mood swings of Javascript arrays? In this blog post, you will understand how to find the Highs (global maximas) and Lows (global minimas) of JS array. Let's begin.
In this blog, lets see several ways in which you can get the first property of an `Object` in Javascript.
When working with the Document Object Model (DOM), manipulating elements dynamically is crucial. One common requirement is to add a CSS class to a parent element based on certain conditions or user interactions. In this blog post, we will explore multiple ways to achieve this, using HTML, CSS, and JavaScript.
Adding event listeners to elements with a specific class is a common task in web development, allowing you to respond to user interactions with elements that share a common identifier. In this guide, we’ll explore different methods to achieve this using JavaScript.
Comprehensive guide on adding a CSS class to multiple DOM elements in HTML using JavaScript, with detailed explanations, multiple examples, and a practice coding problem.
Learn multiple approaches to append arrays in Javascript.
When working with JavaScript Map and Set objects, it's common to need to check if they are empty. Lets explore different ways to achieve this in JS.
Learn 7 ways to convert javascript comma-separated string to array (String methods, Regex, ES6, Lodash), common tips & traps, & a practice Qn.
Learn how to convert an array to a Set, handle arrays of objects, and even add new values to an existing Set.
In this blogpost, we will convert an object’s values or keys into an array.
Use: Spread, Array.from(), convert Nested Maps. Reverse (Array to Map), Optimise by Chunking, Lazy Loading, Web Workers. And a Practice Qn.
See various approaches to convert a Javascript Map into an array of objects.
Explore various ways to create copies of Maps and Sets in Javascript. Whether deep and shallow copies of Maps and Sets, or plain JavaScript and or lodash library.
Dynamically manipulate classes on the `<body>` (or any other) HTML element using JavaScript. Also see the safety and efficiency of classList methods, especially when dealing with multiple classes and potentially missing class names. Let’s dive in!
We can filter a map in JavaScript in three distinct ways: forEach(), filter(), and for...of loops.
Learn 9 ways to find all indices of array element in JavaScript. Also learn common errors and soldifiy your understanding with a Practice Question.
Learn to precisely select elements based on their type in Javascript.
Learn ways to access the first element in a Javascript set: Destructuring, Spread Syntax, Set.values(), and for...of loop.
Learn 4 Ways: 1) split, map, and join ; 2) Regex, map and join 3) split and reduce; 4) Destructuring. Then some common errors and a practice problem.
Learn ways to get javascript array elements: Slice, splice, destructuring, for loop, filter, and lodash.take(). Javascript array tips, and a Practice Qn.
Learn to increment a value associated with a specific key, using: dot and bracket notation, nullish coalescing operator, and the set method.
Learn to iterate and manipulate a JavaScript Map object using forEach(), for...of loops, and more.
Learn to access the first element of a Map in JavaScript using the spread operator, Map.entries(), and Map.keys().
Learn different ways to get the length of a Map in JavaScript using the size property, iteration, and array conversion.
Learn to find the max and min dates in an array of JavaScript objects using the Date object, map, and Math.max/Math.min.
Find the maximum of two numbers in JavaScript, using: Math.max(), the conditional operator, and the spread syntax.
Find the min and max values in JavaScript Maps and Sets using spread syntax, Math methods, and Array.reduce().
Learn 4 ways to remove list item: innetHTML, querySelectorAll, based on index and content. See general DOM list lips and a Practice Qn.
Use: set.size(), or a loop counter. Learn Array.length vs Set.size(), Sparse Array/Set, Non-Primitives comparisons, Mutation's effect, & a Practice Qn.
Learn 7 ways to get JavaScript substring before character (including String methods, Regex, ES6), common tips; traps and a practice Qn.
Sum an array of numbers in JavaScript, using: for...of loop, Array.forEach(), for loop, while loop, and reduce.
See 2 techniques to update Map values in Javascript. And 3 Scenarios where you usually need this: Modifying Single value, Array, and Object. And a Practice Qn.
Understand localStorage access with : Object.entries(); and loops. Learn common errors (for..in), Capacity exceeded, Serialisation, No browser storage support.
See 5 techniques to loop js set. forEach, for...of, Spread syntax, Array.from(), and Set.entries(). Then few common errors, and a practice question.
Parse a JSON array in JavaScript using JSON.parse() and handle exceptions like SyntaxError.
Using String.replace, regex / /g, whitespaces with regex /s/g, String.split & join, custom replacer func, chaining, template literals. Tips and Practice Qn.
Use Object.keys() reverse() values() entries() Generators, Spread operator. ES6 Property Ordering, inherited props, diff with Array, & a Practice Qn.
Learn 6 ways to Sort JavaScript Array Case-Insensitively (including localeCompare, accents, Intl.Collator, common tips, traps and a practice Qn.
Learn to Sort Maps in JavaScript using Keys, Values, Entries pair, Asc/Desc order, Custom sorters, common pitfalls, and a practice Qn.
Learn to modify all the array elements in JavaScript using Array.map(), Array.reduce(), for loop, and Array.fill().