✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Se considera o stiva
function nod(x){ this.x=x; this.urmator=null;}function inserare(){ let x=Number(prompt("valoare x")); let p=new nod(x); p.urmator=varf; varf=p;}function afisare(){ let q=varf; while(q!=null){ console.log("q.x=",q.x); q=q.urmator; }}function stergere(){ if(varf!=null){ let p=varf; varf=p.urmator; p=null; }}let varf=null;let c=Number(prompt("1 - inserare nod in varf, 2 - afisare lista, 3 - stergere nod din varf"));while(c==1 || c==2 || c==3){ if(c==1) inserare(); else if(c==2) afisare(); else stergere();c=Number(prompt("1 - inserare nod in varf, 2 - afisare lista, 3 - stergere nod din varf"));}Faceti asocierile: