-
operators/prompt
hi there,
using prompt I would like to ask the visitors to write any of the"operators"(+,*,- or /)
and let my script give the correct answer:
----------------
youselected=prompt('write an oprerator','you choose')
aa=Math.floor(Math.random()*10)
bb=Math.floor(Math.random()*10)
cc=(aa..(any operators that my visitors selected.."youselected")......bb)
could you please help me with this "javascript problem?"
thanks
-
var a, b, c;
var op = prompt("Operator?", "You choose");
a = Math.floor(Math.random() * 10);
b = Math.floor(Math.random() * 10);
eval("c = a " + op + " b;");
alert(c.toString());