World Factbook

From ProgZoo
Revision as of 09:21, 22 January 2022 by Andr3w (talk | contribs) (Created page with "<pre id='shellbody' data-qtp='fetch'></pre> ==Get a button for each letter== <pre class=usr> fetch('/worldl.json') .then((r)=>r.json()) .then((r)=>{ let letters = r.m...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 on 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 on letters){
       let b = document.createElement('button');
       b.innerText = a;
       document.body.append(b);
     }
  });