JavaScript Strings | String concat() Method

JavaScript Strings | String concat() Method

JavaScript String concat() Method The concat() method is used to join two or more strings..we will explain the javascript string.concat() method with the definition of this method, syntax, parameters, and several examples.

In this tutorial, we will explain the javascript string.concat() method with the definition of this method, syntax, parameters, and several examples.

JavaScript String concat()

JavaScript concat() method, which is used to add or join or combine two or more strings together and it will return a new string.

Syntax

string.concat(string1, string2, string3, ...., stringX);

Parameters of string replace method

| Parameter | Description | | string one, string two, string three, …, stringX | This is required. The strings to be combined or added |

Example:

Here we will take the first example of a javascript string concat() method. We have one string original string and we will add or join two more string in the original string using the concat() method.

var originalString = "JavaScript String, ";
var str1 = " Method The concat()";
var str2 = " Method is used to join two or more strings";

var res = originalString.concat(str1, str2);
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>JavaScript Strings | String concat() Method</title>
</head>
<body>

</body>
<script type = "text/javascript">
    var originalString = "JavaScript String, ";
    var str1 = " Method The concat()";
    var str2 = " Method is used to join two or more strings";

    var res = originalString.concat(str1, str2);

    document.write( "Output :- " + res ); 
</script>  

</html>

Result of the above code is:

Output :- JavaScript String, Method The concat() Method is used to join two or more strings

javascript programming

What's new in Bootstrap 5 and when Bootstrap 5 release date?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Random Password Generator Online

HTML Color Picker online | HEX Color Picker | RGB Color Picker

How to start writing less error-prone code in JavaScript

How to start writing less error-prone code in JavaScript - Everything in JavaScript is an object!’. We said that this assertion is false. Many things in JavaScript can behave like an object, but that doesn’t mean it’s the object. We can say we have three types of objects (objects, functions and arrays) in JavaScript.

The essential JavaScript concepts that you should understand

The essential JavaScript concepts that you should understand - For successful developing and to pass a work interview

Learn Javascript | Intro to programming

Learn Javascipt programming language. This is introduction to programming and Javascript. For more programming videos: ♥ Subscribe: https://www.youtube.com/c...

JavaScript Arrays: 5 Useful Recipes

JavaScript is an incredibly powerful and versatile language. As it has matured through ES5, ES2015, and beyond it has evolved from a…

Java vs. JavaScript: Know The Difference

Java vs. JavaScript: Know the Difference, Java vs. JavaScript: What's the Difference? Java vs. JavaScript: Major Similarities and Differences. pros and cons of JavaScript and Java.