My Custom JavaScript Library _
Look, there are a lot of JavaScript libraries out there, and you’ve probably found one you like and are comfortable with. However, I’ve talked before about why I dislike plugins, so I decided to make my own.
The Small Idea
My plan behind the underscore library is to keep it small and simple. I don’t want to add a bunch of extra features and snazzy functions, just the basic functions to simplify vanilla js a bit.
Syntax
The syntax of the underscore library is very similar to jQuery: you can select and create elements using the _ function:
const heading = _("h1");
const new_heading = _("<h2>");
You can also use the _ function to select elements by id or class:
const my_div = _("#my-div");
const my_divs = _(".my-div");
The library also contains a lot of manipulation functions, like .attribute or .class to change the attributes or classes connected with the elements.
Usage
You can use the underscore library by downloading or linking directly to underscore.js:
<script src="https://cdn.maxpelic.com/underscore/v1/underscore.js" defer>
Learn more at github.com/maxpelic/js.