Forum Moderators: open

Message Too Old, No Replies

alert basics

combining strings and numbers

         

ctoz

6:40 am on Aug 21, 2007 (gmt 0)

10+ Year Member



In
var a = firstchoice()
var b = secondchoice()
var c = third choice()
the three functions each return a number.

In the following, a renders as the number output, OK:
alert('first choice ' + a )

But I'm stumped in extending the alert to include 'second choice ' + b , and 'third choice ' + c.

No matter what kind of separators are used (so far), single quotes, brackets, semicols, the variables a b and c turn into literals; and every character inside the outermost enclosing quotes is also rendered.

The three choices are also separated by \n\n but that doesn't seem to be the problem. Missing something here...

daveVk

7:05 am on Aug 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Am I missing something?

alert('first choice ' + a + ' second choice ' + b + ' third choice ' + c );

ctoz

8:14 am on Aug 21, 2007 (gmt 0)

10+ Year Member



er... no, daveVK, you're not.
: )