0

This HTML program is not satisfying the if else statement , Why ?

<!DOCTYPE html> <html> <head> Javascript </head> <body><script> var myNum1 = 7; var myNum2 = 8; if (myNum1 = myNum2) { alert("This is my first condition"); } else { alert("This is my second condition"); } </script> </body> </html>

20th Jan 2018, 3:43 AM
Radha Bagadi
Radha Bagadi - avatar
1 Respuesta
+ 14
Use == to check condition. if (myNum1 == myNum2){ // }
20th Jan 2018, 3:45 AM
Shamima Yasmin
Shamima Yasmin - avatar