Skip to main content

Ivan Teoh

Something personal yet public

164-exercise25.js

(Source)

1
2
3
4
5
6
7
var theNumber = prompt('What the value of 2 + 2 is?', '');
if (theNumber == '4')
    alert('Correct! Well done.');
else if (theNumber == '3' || theNumber == '5')
    alert('Almost!');
else
    alert('Ops! Please try again!');