class Nodo {
constructor(dato)) {
this.dato=dato;
this.siguiente=null;
}
}
class Pila{
constructor(){
this.cima=null;
}
estaVacia(){
return this.cima==null;
}
push(dato){
const nuevo=new Nodo(dato);
nuevo.siguiente=this.cima;
this.cima=nuevo;
}
pop(){
if((this.estaVacia)) return null;
const dato=this.cima.dato;
this.cima=this.cima.siguiente;
return dato;
}
mostrar(){
const actual=this.cima;
while(actual!=null){
console.log(actual.dato);
actual=actual.siguiente;
}
}
}
function Validacion(ecuacion) {
console.log('ANALIZANDO LA ECUACION: ${ecuacion}');
}
To embed this program on your website, copy the following code and paste it into your website's HTML: