A simplified approach using some ES6 methods.
Miscellaneous
Check if two arrays or objects are equal
A robust way to compare two arrays (or objects) and check if they’re equal to each other.
Prevent the default action of an event
Use the preventDefault() method. This method works with inline attribute.
Get Siblings of an Element
This snippet gets the next sibling and previous sibling of an element, using the element.nextSibling and element. previousSibling properties.
Get size of the selected file
This snippet can be used to validate a file’s size and display it, for instance when a file is being submitted for upload.
Resize an iframe to fit its content
This snippet gets the height of an iframe’s content and then sets the height of the iframe to match.
Xmas Tree Generator
This script makes a random sized Christmas tree with random lights.
Multiple Choice Quiz
Add a quiz to your Web page without using a server-side script. Easy to set-up. Questions and answers are stored in a multi-dimensional array format in an external file. The quiz is marked in real time, and once answered, questions are set to read-only. A summary of the users score is alerted at the end.