I received a question about this snippet of code:
function def(first="oldValue" , second=function(){
return first;
}){
var first="updatedValue";
console.log('inside',first);
console.log('function',second());
}
const input = document.getElementById('lbsInput'); | |
const output = document.getElementById('output'); | |
output.style.visibility = 'hidden'; | |
input.addEventListener('input', (e) => { | |
let lbs = e.target.value; | |
output.style.visibility = 'visible'; |
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.0.0/workbox-sw.js"); | |
if (workbox) { | |
console.log("Yay! Workbox is loaded !"); | |
workbox.precaching.precacheAndRoute([]); | |
/* cache images in the e.g others folder; edit to other folders you got | |
and config in the sw-config.js file | |
*/ | |
workbox.routing.registerRoute( |
const input = document.getElementById('lbsInput'); | |
const output = document.getElementById('output'); | |
output.style.visibility = 'hidden'; | |
input.addEventListener('input', (e) => { | |
let lbs = e.target.value; | |
output.style.visibility = 'visible'; |
@import url('https://fonts.googleapis.com/css?family=Roboto+Mono'); | |
@import url('https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'); | |
body { | |
background-color: #333; | |
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='30' viewBox='0 0 1000 120'%3E%3Cg fill='none' stroke='%23222' stroke-width='10' %3E%3Cpath d='M-500 75c0 0 125-30 250-30S0 75 0 75s125 30 250 30s250-30 250-30s125-30 250-30s250 30 250 30s125 30 250 30s250-30 250-30'/%3E%3Cpath d='M-500 45c0 0 125-30 250-30S0 45 0 45s125 30 250 30s250-30 250-30s125-30 250-30s250 30 250 30s125 30 250 30s250-30 250-30'/%3E%3Cpath d='M-500 105c0 0 125-30 250-30S0 105 0 105s125 30 250 30s250-30 250-30s125-30 250-30s250 30 250 30s125 30 250 30s250-30 250-30'/%3E%3Cpath d='M-500 15c0 0 125-30 250-30S0 15 0 15s125 30 250 30s250-30 250-30s125-30 250-30s250 30 250 30s125 30 250 30s250-30 250-30'/%3E%3Cpath d='M-500-15c0 0 125-30 250-30S0-15 0-15s125 30 250 30s250-30 250-30s125-30 250-30s250 30 |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> | |
<meta name="description" content="Simple weight converter"> | |
<title>Weight Converter</title> |
// Every object (except the root object) has a prototype (parent). | |
// To get the prototype of an object: | |
Object.getPrototypeOf(obj); | |
// In Chrome, you can inspect "__proto__" property. But you should | |
// not use that in the code. | |
// To get the attributes of a property: | |
Object.getOwnPropertyDescriptor(obj, 'propertyName'); |
I received a question about this snippet of code:
function def(first="oldValue" , second=function(){
return first;
}){
var first="updatedValue";
console.log('inside',first);
console.log('function',second());
}
let user = { | |
name: "Bolaji" | |
}; | |
let descriptor = Object.getOwnPropertyDescriptor(user, 'name'); | |
console.log(descriptor); | |
// {value: "Bolaji", writable: true, enumerable: true, configurable: true} |
let obj = { | |
key1: "value1", | |
key2: "value2", | |
key3: "value3" | |
} | |
let items = Object.entries(obj); | |
console.log(items); | |
// 0: ["key1", "value1"] | |
// 1: ["key2", "value2"] | |
// 2: ["key3", "value3"] |
let obj = { | |
key1: "value1", | |
key2: "value2", | |
key3: "value3" | |
} | |
let items = Object.getOwnPropertyNames(obj); | |
console.log(items); | |
// ["key1", "key2", "key3"] | |
items.map(key => { | |
let value = obj[key]; |