Difference between revisions of "World Factbook"
Jump to navigation
Jump to search
Line 7: | Line 7: | ||
.then((r)=>{ | .then((r)=>{ | ||
let letters = r.map(c=>c.name[0]); | let letters = r.map(c=>c.name[0]); | ||
for(let a | for(let a of letters){ | ||
let b = document.createElement('button'); | let b = document.createElement('button'); | ||
b.innerText = a; | b.innerText = a; | ||
Line 19: | Line 19: | ||
.then((r)=>{ | .then((r)=>{ | ||
let letters = r.map(c=>c.name[0]); | let letters = r.map(c=>c.name[0]); | ||
for(let a | for(let a of letters){ | ||
let b = document.createElement('button'); | let b = document.createElement('button'); | ||
b.innerText = a; | b.innerText = a; |
Revision as of 09:22, 22 January 2022
Get a button for each letter
fetch('/worldl.json') .then((r)=>r.json()) .then((r)=>{ let letters = r.map(c=>c.name[0]); for(let a of letters){ let b = document.createElement('button'); b.innerText = a; document.body.append(b); } });
fetch('/worldl.json') .then((r)=>r.json()) .then((r)=>{ let letters = r.map(c=>c.name[0]); for(let a of letters){ let b = document.createElement('button'); b.innerText = a; document.body.append(b); } });