Change it into this:
var fact;
fact = Math.ceil(Math.random()*4)
if (fact == 1) {
document.write('Hi');
}else if(fact == 2){
document.write('Nope');
With an
==
operator, you compare objects and with an
=
operator, you set the value of an object.
In your code, you didn't compare the two variables, but you did set the
fact
variable to
1
in your first
if
statement.