A simplified approach using some ES6 methods.
A robust way to compare two arrays (or objects) and check if they’re equal to each other.
Use the preventDefault() method. This method works with inline attribute.
This snippet gets the next sibling and previous sibling of an element, using the element.nextSibling and element. previousSibling properties.
This snippet can be used to validate a file’s size and display it, for instance when a file is being submitted for upload.
This snippet gets the height of an iframe’s content and then sets the height of the iframe to match.
This script makes a random sized Christmas tree with random lights.
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.