Passing Custom Parameters to setTimeout Callback
The setTimeout() method can have multiple parameters depending on the need. Custom parameters can be passed after the callback function and timeout parameters. These extra parameters are passed to the callback function - as its arguments.
Implementing Share Button on Websites with the Web Share API
The Web Share API helps a user in sharing text or URL in a website by using the sharing mechanism of the device. With this API we can add a "Share" button in a website.
Creating Objects with Dynamic Keys in Javascript (ES6 Way)
ES6 has brought in Computed property names that helps in creating a new object with dynamic property names. The dynamic keys are specified between [ ] square brackets.
Javascript Rest Parameter
Rest parameter syntax can be used in function declarations to compress passed arguments to an array. By using the Rest parameter syntax indefinite number of arguments can be passed to a function.
Javascript Spread Operator
Spread operator will expand an iterable, such as an array or a string. Expansion here means that the input object is broken down to its individual values.
How to Read Local Files with Javascript
There are some cases where a web application needs to read a local file from the user's system. This can be done with the FileReader interface.
Merging of Arrays in JavaScript
The concat() method can be used to merge two or more arrays. Duplicates in the merged array can be removed using a Set object.
Extracting a Part of an Array in JavaScript
A part of an array can be extracted with the Array.slice() method.
Getting Browser Window Size with JavaScript
JavaScript has built-in methods which returns the browser window dimensions. We can also listen to an event to track resizing of the browser window.
Intersection and Difference of Arrays in JavaScript
The filter() method can be used to get intersection or difference of arrays. Duplicates can be eliminated by converting array to a Set object.
Union of Arrays in JavaScript
Union of arrays would represent a new array combining all elements of the input arrays, without repetition of elements.
Representing Very Large Numbers in Javascript with BigInt
BigInt is a new data type introduced in Javascript that can handle extremely large numbers. Such large numbers are typically created in financial sectors or in creating high-accuracy timestamps.
Vibrating Mobile Devices with Javascript
The Vibration API makes it possible for a web application to vibrate a mobile device with Javascript. Single or multiple vibrations can be performed with this.
Removing Elements from an Array with Javascript
The shift(), pop() and splice() methods can be used to delete elements from any position in the array.
Reversing an Array with Javascript
The reverse() method can be used to reverse the order of elements in an array.
Adding Elements to an Array with Javascript
The push() / unshift() methods can add elements to end / front of an array. The splice() method can be used to add elements at any position in the array.
jQuery position() in Pure Javascript
jQuery position() method gives the top-left position of the element relative to its offset parent element. Its equivalent in native Javascript can be found using the offsetTop and offsetLeft properties.
How to Get User Location Information with Javascript
The Geolocation API makes it possible to retrieve the current geographical location of the user. Latitide, longitude, altitude and many other location information can be fetched.
jQuery offset() in Pure Javascript
jQuery offset() method gives the top-left position of the element relative to the whole document. In Javascript there is no native method that directly gives this value, we need to calculate it.
How to Create a HTML Slider / Carousal
This tutorial shows how to create a slider / carousal from scratch using HTML, CSS & Javascript. Using a custom self-made slider can prevent inclusion of external plugins in your application.