Reputation: 25
I have created this JavaScript code and tried running in chrome:
var string1 = "Hello";
var string2 = "Goodbye";
alert(string1);
alert(string2);
string2 = string1;
alert(string1);
alert(string2);
string1 = "Now for something different";
alert(string1);
alert(string2);
as you can see, it's supposed to output 6 alert boxes with different outputs, the problem is I'm only seeing 3 (it ends in the 3rd "Hello" variable).
thanks in advance for your help.
Upvotes: 0
Views: 50
Reputation: 3158
var string1 = "Hello";
var string2 = "Goodbye";
alert(string1);
alert(string2);
string2 = string1;
alert(string1);
alert(string); // change this line with alert(string2);
string1 = "Now for something different";
alert(string1);
alert(string2);
Upvotes: 0
Reputation: 680
In the seventh line, correct your alert(string)
to alert(string2)
.
Upvotes: 1