August 17, 2024
JavaScript String Concatenation
In JavaScript you can do string concatenation through + operator. + operator is a concatenation operator for string values and it also an addition operator for numeric values. So when you want to concatenate two or more strings you can use + operator. The example of string concatenation mentioned below:
Code
<html>
<head>
<title>JavaScript String Concatenation</title>
</head>
<body>
<script language='JavaScript' type='text/JavaScript'>
var weekDaysString1 = 'Sunday,Monday,Tuesday,Wednesday,Thursday,';
var weekDaysString2 = 'Friday,Saturday';
var allWeekDays = weekDaysString1 + weekDaysString2;
</script>
</body>
</html>