Very basic javascript question! Newbie alert!

So, I’m teaching myself javascript basics and had a question:

When I write something like

var $fullName = $firstName + ' ' + $lastName;

Why do i have to have 2 ‘+’ operators instead of just one? I thought you write it like

var $fullName = $firstName + ' ' $lastName;

Thank you.

Hey skunker,

You write it with two pluses because you are concatenating three strings: $firstName, a space and $lastName.

PPK has a good explanation of this: http://www.quirksmode.org/js/strings.html#conc

HTH