Quick intro to JavaScript CSS ClassLIst API

Of all the ways people have been using jQuery, one of the methods that rank high up there is jQuery's CSS class manipulation methods, which are:


These functions make it extremely easy to add, remove, and check whether an element has a particular CSS class.

Well, all modern browsers now allow you to do away with jQuery for duplicating the above functions. The classList API is pretty self explanatory. See the below:

el.classList.add("myclass") //adds a class to element

Defining an array in JavaScript

There are 3 ways of defining an array in JavaScript, each with its own charm.

Create robust functions

To define a function that can accept arbitrary number of parameters in
JavaScript, invoke the arguments array within the function. This special array
contains all of the parameters passed into it.

Syndicate content