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
//copy = Array.prototype.with(index, value) | |
//changed = Array.prototype.copyWithin(index, start, end) | |
const names = ['Bob', 'Louise', 'Gene', 'Linda', 'Teddy']; | |
const newNames = names.with(1, 'Gayle'); // names[1] = 'Gayle' | |
console.log(names); | |
console.log(newNames); | |
console.log(names == newNames); //false | |
console.log(names === newNames); //false |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>SVG Progress Display for File Downloads</title> | |
<style> | |
:root { | |
--bgcolor: hsl(220, 20%, 70%); | |
--focuscolor: hsl(220, 80%, 50%); |
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
{ | |
"categories": ["historical fiction", "science fiction", "fantasy", "romance", "non-fiction", "programming", "classic"], | |
"books": [ | |
{ "id": "cc196ef3-431f-4238-8aea-8a94e73229a4", "category": "science fiction", "title": "the 3 body problem", "author": "cixin lin" }, | |
{ "id": "e2fd5989-6908-45c5-91db-d6e561fc8b8b", "category": "fantasy", "title": "the hobbit", "author": "j.r.r. tolkien" }, | |
{ "id": "ee69e09a-61f0-4c19-bbbc-826399f678c4", "category": "programming", "title": "web developers practical guide to flutter", "author": "steve griffith" }, | |
{ "id": "dbc27431-33b4-49fb-82a4-1ab9bea0f26a", "category": "classic", "title": "moby dick", "author": "herman melville" }, | |
{ "id": "ef78671c-d518-468c-bfdf-4786c3a03c19", "category": "non-fiction", "title": "superintelligence", "author": "nick bostrom" } | |
] | |
} |
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
import { useState } from 'react'; | |
export default function Form() { | |
const [firstName, setFirstName] = useState(''); | |
const [age, setAge] = useState(''); | |
const ageAsNumber = Number(age); | |
// ... | |
return ( | |
<form> |
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
[ | |
{ | |
"uuid": "a1b2c3d4-e5f6-g7h8-i9j0k1l2m3n4", | |
"name": "Sterling Archer", | |
"show": "Archer", | |
"voice_actor": "H. Jon Benjamin" | |
}, | |
{ | |
"uuid": "b2c3d4e5-f6g7-h8i9-j0k1l2m3n4o5", | |
"name": "Leela", |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Cache Storage</title> | |
<link rel="stylesheet" href="./css/main.css" /> | |
<script type="module" src="./js/main.js"></script> | |
</head> | |
<body> |
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
const url1 = 'https://picsum.photos/id/123/300/200'; //200 status | |
const url3 = 'https://picsum.photos/id/237/300/200'; //200 status | |
// const url3 = 'https://picsum.photos/id/466/300/200'; //200 status | |
const url2 = 'https://jsonplaceholder.typicode.com/posts'; //200 status | |
const url6 = 'http://127.0.0.1:5500/300/index.html'; | |
const url4 = 'https://picsum.photos/id/999999/300/200'; // 404 status | |
const url5 = 'https://example.com/bad-url'; //bad domain | |
import { AfternoonError } from './error.js'; | |
document.addEventListener('DOMContentLoaded', () => { |
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
//promises.js | |
document.addEventListener('DOMContentLoaded', function () { | |
getData(); | |
}); | |
function getData() { | |
let url1 = 'https://picsum.photos/id/237/300/200'; | |
let url2 = 'https://picsum.photos/id/466/300/200'; | |
let url3 = 'https://picsum.photos/id/123/300/200'; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Syncing Data Page</title> | |
<script src="./js/main.js" type="module"></script> | |
<link rel="stylesheet" href="./css/main.css" /> | |
</head> | |
<body> |
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
class Burger { | |
#isMeatless = false; | |
#isCooked = false; | |
toppings = []; | |
constructor(_isMeatless = false, ...toppings) { | |
this.#isMeatless = _isMeatless; | |
this.toppings = toppings; | |
} |