Select Page

Just a quick JavaScript reminder.

If you add two numbers in a row and then add some text you get something entirely different than if you combine number, text, number, text.

Example:

Variable values:

sectionIndex=2
qIndex=3

Option 1
sectionIndex + qIndex + “SomeText” = 5SomeText

Option 2
sectionIndex + “” + qIndex + “SomeText” = 23SomeText

Fortunately it didn’t take long to, ahem, “remember” this once I started looking.