View main.js
This file contains 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
//new.target meta property | |
function Being() { | |
// | |
console.log(new.target); | |
if (new.target === undefined) throw new TypeError('Missing new'); | |
if (!new.target) throw new TypeError('Missing new'); | |
console.log(typeof new.target); //function | |
console.log(new.target.name); // Being |
View index.html
This file contains 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
<!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.0" /> | |
<title>Document</title> | |
<link rel="stylesheet" href="./main.css" /> | |
</head> | |
<body> |
View app.js
This file contains 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
const names = ['sheldon', 'amy', 'penny', 'leonard', 'raj', 'buffy', 'howard', 'bernadette']; | |
const DEMO = { | |
cacheref: null, | |
cachename: 'gelatenous-cube', | |
cacheReady: false, //change to true after files are saved in the cache | |
init() { | |
//build a bunch of files and save them in the cache | |
//then read all the files from the cache | |
DEMO.addListeners(); |
View index.html
This file contains 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
<!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.0" /> | |
<title>Document</title> | |
<style> | |
p { | |
padding: 1rem; |
View main.js
This file contains 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
// structuredClone( ) method | |
const log = console.log; | |
//objects with primitives | |
let obj1 = { prop1: 'abc', prop2: 123 }; | |
//objects containing objects | |
let names = ['fred', 'velma', 'daphne', 'shaggy']; | |
let obj2 = { prop3: 'def', prop4: names }; | |
//objects with non-serializable props |
View app.js
This file contains 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
document.addEventListener('DOMContentLoaded', () => { | |
document.body.addEventListener('click', getData); | |
}); | |
function getData(ev) { | |
//get some data from the random-data-api | |
const type = 'users'; // beers users credit_cards addresses | |
const url = new URL(`https://random-data-api.com/api/v2/${type}`); | |
let params = new URLSearchParams(); | |
//size - number of records to return (default is 1) |
View index.html
This file contains 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
<!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.0" /> | |
<title>RoboHash API</title> | |
<style> | |
html { | |
font-size: 20px; |
View main.js
This file contains 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
const log = console.log; | |
//Strong Ref and Reachability - the default state | |
let person = { id: 123, name: 'Shaggy' }; | |
let list = [person]; | |
person = null; //destroys one reference | |
//person list[0] | |
// log(list); | |
// log(person); | |
//Set - unique list of values, any datatype, strong ref |
View app.js
This file contains 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
const APP = { | |
currentPage: 'home', | |
init() { | |
//page has loaded | |
}, | |
addListeners() { | |
//add DOM listeners | |
}, | |
navigate(page) { | |
//navigate to a new page |
View 404.html
This file contains 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
<!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.0" /> | |
<title>404</title> | |
<link rel="stylesheet" href="main.css" /> | |
<style> | |
html { |
NewerOlder