Monthly Archives: April 2015

How to Concatenate String in Javascript

How to concatenate string in Javascript. Concatenate one or more string in javascript.
It is done using the following methods

  • The addition operator ( + )
  • The assignment operator ( += )



  • The built-in concat method

Method 1 : Using + Operator

Simple and easiest way to concatenate one or more strings is through + operator.





TheOUTPUT will be:

concatenate string test

Method 2: Using += Operator

Simple and easiest way to concatenate one or more strings is through += operator.





The OUTPUT will be:

concatenate string test

Method 3: Using Javascript concat() method.

Simple and easiest way to concatenateone or more string through concat() inbuilt function in javascript.

SYNTAX

string.concat(string1, string2, …, stringX)





The OUTPUT will be:

concatenate string test