Skip to content

Instantly share code, notes, and snippets.

View inezabonte's full-sized avatar
🙂
Howdy

Ineza Bonté Grévy inezabonte

🙂
Howdy
View GitHub Profile
function hello(name = 'George'){
console.log(`Hello ${name}`)
}
hello()
// Output: => "Hello George"
// Because "George" is the default set name in the parameters
hello('Stacy')
// Output: => "Hello Stacy"
@inezabonte
inezabonte / checkConnection.js
Created October 28, 2020 12:48
Checking if you are connected to the internet
let connection = document.querySelector('.connection')
let status = document.querySelector('.status')
window.addEventListener("load", (event) => {
let result = navigator.onLine;
if(result){
status.textContent = "Connected"
} else{
connection.classList.toggle('offline')
status.textContent = "Disconnected"