get battery percentage using javascript code example
Example: battery percentage js
navigator.getBattery()
.then(function(battery) {
console.log(battery.level);
});
navigator.getBattery()
.then(function(battery) {
console.log(battery.level);
});