alert() Javascript command not working online all the time

jospercomp shared this question 3 months ago
Answered

I am using the alert command several times in a JavaScript code but it is showing me the information only of the last alert that I have in the code. It only occur in online Geogebra version.

This is an example for them to test why this error occurs.

var num=prompt("Entre un valor",5);

alert("El valor almacenado en la variable num fue: "+num);

ggbApplet.evalCommand("num="+num);

var str=prompt("Entre un mensaje: ","Hola Mundo");

alert("El mensaje almacenado en la variable num fue: "+str);

ggbApplet.evalCommand("str=\""+str+"\"");

var list=prompt("Entre un mensaje: ","{1,2,3,4}");

alert("El mensaje almacenado en la variable list fue: "+list);

ggbApplet.evalCommand("list="+list);

Comments (9)

photo
1

Please post your .ggb file

photo
2

That's expected; each call overwrites the previous

photo
1

Is there a command that pauses to see the information contained in the alert before it is rewritten?


For example, system("pause") such as cpp or a sleep function.

photo
2

Is it just for debugging? Try ggbApplet.debug() and look in the console

photo
1

Where do I find the Java console where prints the string is shown?

photo
1

You'll probably need to run GeoGebra from the command line and/or help - about - system information

photo
1

How I run Geogebra from the command line in Windows 10 and Linux Ubuntu?

efc8e4ad570a5f788d9706e488cbcb80

photo
© 2019 International GeoGebra Institute