JavaScript BatteryManager API Demo
Navigator object provides Battery API for accessing charging attribute. a BatteryManager object can be accessed using getBattery() method. In this demo, “We will learn to access charging attribute on chargingchange event fired by BatteryManager”. The following code shows the accessing of BatteryManager API. <!DOCTYPE html> <html> <head lang="en"> <title>Battery Demo</title> </head> <body> <script> navigator.getBattery().then(function(battery) […]
Lodash Pluck And Where Method Example
lodash provides many utility methods for JavaScript developer. pluck() method is used for get the values of keys from a collection/array. where() method returns an array of element with matching property values. In this demo, “We will learn to use the methods pluck and where in lodash utility library”. The following code shows the […]
Random Number Generator Using Lodash Utility
lodash provides _.random() method to generate number. It takes 3 parameter min,max and boolean flag.The boolean flag with true value indicates the output as floating point number. In this demo, “We will learn about random() method to generate a random number”. The following code shows the use of random() method. <!DOCTYPE html> <html> <head> […]
Getting Started With Lodash Utility Library
lodash provides a utility library for JavaScript.it contains a set of methods and properties to work with data. lodash provides Array, Chain, Collection, Date, Function, lang, Number, Object, String ,Utlity, Object, String, Methods and Properties. documentation for lodash library can be found in following link https://lodash.com/docs. In this […]