Pages

Working with strings

+  operator is used to work with strings in javascript . + is used to combine strings or to append variables to a string . e.g.

                          var sentence = "You are " + var ;

This will append value  of variable to the string You are . e.g. if

                          var = "Andy" ;

then output will be  You are Andy .

In this case var is used to define a variable . Also JavaScript is a loosely typed language meaning you don't have to define a variable type by default such a int var or char var . JavaScript automatically assigns a data type to the variable .