Full-time coder, part-time drummer. Enjoys using and building software on the web, and is a massive fan of JavaScript.
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
Videos are pretty popular on the web these days. But what if your users want to add them to content? Here's how I added YouTube and Vimeo video embeds to Tiptap editor in ReactJS.
Written by Codemzy in JavaScript on May 18th, 2022
Once you know how to write a function in JavaScript, you also need to know how to call it. You can call it from your code, immediately, after an event, in your HTML, after a delay, or regularly. Let's see how.
Written by Codemzy in JavaScript on April 20th, 2022
If you have a sticky or fixed position header with a textarea or a contenteditable element, the soft keyboard can push it off the screen on iOS devices. Not good if you need it to stay visible during editing. Here's how you can fix it.
Written by Codemzy in JavaScript on March 9th, 2022