Instead of writing an if-else on multiple lines, you can use the ternary operator to write the whole statement with one line of code.
Get the currently selected text with JavaScript
Use Window.getSelection() and Selection.toString() to get the currently selected text.
Javascript Conditionals Explained
Conditional statements control behavior in JavaScript and determine whether or not pieces of code can run.
Get the default value of a CSS property with JavaScript
The following function returns the default value of CSS property for given tagName.
How to loop through arrays and array-like objects in JavaScript
Here is how to loop through arrays and array-like objects using JavaScript.
How to Get the Query String in JavaScript
When you’re working with JavaScript, sometimes you need to access query string parameters in your script.
Check if the given year is a leap year
Use new Date(), setting the date to February 29th of the given year. Use Date.prototype.getMonth() to check if the month is equal to 1.
JavaScript Functions Explained
JavaScript functions are reusable blocks of code that perform a specific task, taking some form of input and returning an output.
Submit a form with Ajax
The following function submits the data of formEle to the back-end using an Ajax request
Get and Set Classes On An Element
Get all of the classes on an element as a string, add a class or classes, or completely replace or remove all classes.