✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Se considera crearea unei liste dinamice cu inserarea unui nod nou la sfarsitul listei.
function nod(x){ this.x=x; this.urmator=null;}function inserare(){ let x=Number(prompt("Valoare x")); let q=new nod(x); if(p==null) p=q; else u.urmator=q; u=q;}function afisare(){ let q=p; while(q!=null){ console.log(q.x); q=q.urmator; } }let p=null, u=null;let c=Number(prompt("1-inserare, 2-afisare"));while(c==1 || c==2){ if(c==1) inserare(); else afisare();c=Number(prompt("1-inserare, 2-afisare")); }Faceti asocierile