Return Array.prototype.slice(1) if Array.prototype.length is more than 1, otherwise, return the whole array.
JavaScript Objects Explained
JavaScript objects are variables that contain multiple data values. The values within a JS object are known as properties. Objects use keys to name values, much like how is done with variables.
Paste an image from the clipboard
Here’s how to paste an image from your computer’s clipboard using JavaScript.
Highlight an element when dragging a file over it
We will highlight the element when user drags a file over it. For example, the element will have a dashed border which can be simulated by a CSS class.
Get the computed style of an element
Get the actual computed style of an element. This factors in browser default stylesheets as well as external styles you’ve specified.
Remove Duplicates From an Array
In JavaScript, Set is a collection that lets you store only unique values. This means any duplicated values are removed.
Return the current URL
Use Window.location.href to get the URL of the current page.
JavaScript Arrays Explained
Arrays are container-like values that can hold other values. The values inside an array are called elements.
Get the direction of the text selection
This function returns forward if user selected text from the left to right. It returns backward in the other case.
Get and set inline styles for an element
Get a style, and then if this style is not set as an inline style directly on the element, it returns an empty string.