Hello! I am Codemzy and I love to code. JavaScript is my favourite flavour. I blog about coding, software and my projects.
You can sort any array of objects in JavaScript using the `sort()` method and giving it a compare function with the property value you want to sort by. Here's how it works with examples.
Written by Codemzy in JavaScript on May 22nd, 2023
Need to be able to drag and drop image files into your Tiptap WYSIWYG editor? Tiptap is highly customisable, so let's add some drag-and-drop magic to the Image extension.
Written by Codemzy in JavaScript on January 27th, 2023
If you need a simple short ID and don't have any complex requirements for it, then a simple JavaScript function could be all you need. Here's the function I use to create a random unique ID in JavaScript, and an explanation of how it works.
Written by Codemzy in JavaScript on January 13th, 2023
Looping over arrays is fairly easy in JavaScript, but harder with objects, because you can't use array functions like `Array.map()`. Or can you?
Written by Codemzy in JavaScript on August 24th, 2022
Here's the conditional object property pattern. It uses the spread syntax (...) to conditionally add a property to an object, or an item to an array. Perfect when you (sometimes) want to add a key to an object.
Written by Codemzy in JavaScript on August 15th, 2022
Copying objects in javascript can get complicated if you only want to copy part of an object, or if there is a property or key that you don't need. Instead of copying the entire object and then deleting a property, you can just copy what you need with object destructuring.
Written by Codemzy in JavaScript on July 27th, 2022