Blog
JavaScript Snippet – Unicode Emoji As A Favicon
Would you like to learn how to easily set a unicode emoji as a favicon on any web page with a few lines of JavaScript? Check out this short video! Here is the GitHub Gist:
Would you like to learn how to easily set a unicode emoji as a favicon on any web page with a few lines of JavaScript? Check out this short video! Here is the GitHub Gist:
Have you ever used JSBin or CodePen and wondered how you can accomplish something like they do on those sites? Of course, CodePen is much more advanced and has more options but if you ever want to combine JavaScript code and CSS code into a full or partial HTML document Read more…
When writing an Aura Lightning Component you can use the following to update data for standard components as detailed on this page: Unfortunately, with Lightning Web Components you cannot run the above code as is. Fortunately, you can easily modify the above to make it work in an LWC. All Read more…
Did you know that you cannot use querySelectorAll() function on <template> elements? By that I mean that the following code will in fact not return any results: The same thing can be said about trying to use querySelectorAll() function on <template> elements: This even happens when calling either one of Read more…
In JavaScript you can create a function by using the Function constructor: The above code produces a sum() function which takes 1 or more arguments and returns the sum of them all added together. You can check out the following to see this in action: What About AsyncFunction()? You may Read more…
There are a lot of online converters out there that will take XML file contents and turn it into JSON. I decided to make my own and then show how simply this can be done with modern JavaScript: How Does It Work? The code which makes this work is given Read more…
There are many websites that make it super easy to import node packages into your website. One of them is Unpkg.com. If you want to import a package into your web page or website you can try using the following: As you can see in the JSDoc annotation, this function Read more…
At times you may want to set a minimum height and/or a maximum height for an Lightning Web Component Datatable. The documentation may lead you to believe that you cannot accomplish this but with some CSS3 you definitely can. If you go to the LWC Datatable docs you will see Read more…
Did you know that you can pass a function as the second parameter to JSON.parse()? Doing this causes every key/value pair to be passed to this function for further processing. You can read all about how JSON.parse() and the reviver function works here on MDN’s site. Example Reviver We can Read more…
Last year I needed a way to be able to parse JSON with comments (also known as JSONC). With that in mind I wrote the following short solution which will essentially remove JavaScript-style comments and trailing commas from the specified JSONC string and then the native JSON.parse() function will parse Read more…