Concatenate Text String

Concatenating means combining text string to get full message. It can also combine string and number, number and number etc.

Code Structure
Example 1:
var name = "John";
alert("Welcome " + name + "!");

// Output: Welcome John!

Example 2:
var num1 = "5";
var num2 = "7";
alert(num1 + num2);

// Output: 57 because number are inside quotes which makes them string.

Share this

Related Posts