Displaying Date and Time in Javascript
In Javascript, date and time are handled with the built-in Date object. The Date objects has several methods such as getDate(), getMonth(), toLocaleString() etc to customize the format of the date-time string.
Tagged Templates Literals
Tagged templates can be thought of as an advanced form of template literals, where the placeholders (${variable}) and text are passed through a function.
Pre-Loading and Pre-Decoding Images with Javascript for Better Performance
Pre-loading an image is a popular technique to improve performance. However it is also possible to pre-decode the image for a bigger performance boost.
Creating Multi-line Strings in Javascript with Template Literals
ES6 Template Literals is the new way of creating multi-line strings in Javascript. Variables and expressions can also be substituted in a template literal multi-line string.
Repeating Strings in Javascript
Sometimes it is required to keep repeating a string for a specific number of times. The new ES6 function repeat() can help you to do so.
Padding Strings in Javascript
It is sometimes required to make sure that strings are of a specific length. padStart() and padEnd() functions can help you to achieve this.
Trimming Strings in Javascript
Strings can be trimmed in Javascript using the native trim functions — trim(), trimStart() & trimEnd()
Intersection Observer API in Javascript
The Intersection Observer API is probably one of the most useful Web APIs that have been released recently. The API keeps track of intersection between two elements in a webpage.
Checking for Substrings in Javascript - ES6 Methods
ES6 has brought forwards newer ways of checking for substrings. The best part is that they all return either a true or false — unlike the usual indexOf() method.
How to Know when an Element Gets Visible in the Screen During Scrolling
Previously finding whether an element has entered the screen used to be a pain, but the new Intersection Observer API makes this quite easy, and less error prone.
Using the Reviver Function in JSON.parse
JSON.parse accepts an optional second parameter - the reviver function. The purpose of this function is to modify the result before returning, and can be thought of as filter function.
Displaying 360-Degree Photos & Videos on Websites using Google VR View
360-degree photos and videos really give an enhanced user experience. They can be embedded in web pages using Google VR Javascript SDK.
Creating Modal Dialog and Lightbox Becomes Easier with HTML <dialog> Tag
The new <dialog> tag makes it easier to create dialogs and lightboxes. With Javascript you can also call methods to open the dialog or close it, or know when the dialog was closed.
Detecting when an Element Becomes Fixed in CSS position:sticky with an Intersection Observer
Creating an element which would become fixed during scrolling has become very easy with CSS position : sticky. And with the new Intersection Observer API, it can be detected when an element comes in/out of sticky position.
How to Change Screen Orientation with Javascript
Changing screen orientation becomes somewhat necessary in some cases, like playing HTML5 games in the browser. Screen orientation can be changed and locked using the new Screen Orientation API.
Handling Uncatched Promise Rejections in Browser
Modern browsers have brought forward the unhandledrejection event. This is fired when a Promise is rejected, but there is no rejection handler function implemented in the code.
Loading CSS Files with Javascript
Loading external CSS files with Javascript is beneficial because it improves the loading time of the page.
Loading External Javascript Files with Javascript
Loading Javascript files dynamically is beneficial because it improves the loading time of the page. It can be done by appending a new script tag in the html.
Offline / Online Detection with Javascript
With a lot of stress on "offline mode for web applications", applications need to know when the user has gone offline. They also need to know when the user comes back online again.
Text to Speech with Javascript
In modern browsers text to speech feature is built natively in them. This means that you don't need external plugins or APIs to convert text to speech !