Created
February 6, 2025 18:26
-
-
Save cmbaughman/a4cafb54108e79756891448771c2b14e to your computer and use it in GitHub Desktop.
Wild Javascript APIs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get connection speed | |
if (navigator.connection) { | |
const downlink = navigator.connection.downlink; | |
console.log(`Current download speed: ${downlink} Mbps`); | |
} | |
else { | |
console.log("Network Information API not supported"); | |
} | |
// Mobile device vibrate | |
if (navigator.vibrate) { | |
navigator.vibrate(500); // in milliseconds | |
} | |
// Group console.logs | |
console.group('Group Label'); | |
console.log('Log message 1'); | |
console.log('Log message 2'); | |
console.groupEnd(); | |
// See all of an object's properties | |
const obj = { prop1: 'Test', prop2: 22222 }; | |
console.dir(obj); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment