I was required to create an html page that displays the result of 2 + 2 via an alert when the page loads. My code was follows:
var x = 2;
var y = x + x;
alert("The result of 2 + 2 is " + y);
I simply defined two variables. x and y. The alert was a simple concatenation of the string and the value of y.
Click here to see the html page
No comments:
Post a Comment