String prototype concat() in Javascript.

Nk Rafi
1 min readMay 7, 2021

--

A string is a data type used in programming languages, such as an integer and floating-point, but is used to display text like “Hello World” rather than numbers. It is comprised of a set of characters that can also contain spaces and numbers. In programming, the string has some built-in functions known as methods. Among all concat() is a method for strings. What it really does? let’s see.

concat() is a string method that is used to concatenate two or more strings. Concatenation means addition of two or more strings. Example:

let myString = "Hello";
console.log(mystring.concat('', "World"));
#output:
"Hello World"

In the concat() you can pass one or more strings to concatenate. The concat() method concatenates the string arguments to the calling string and returns a new string. If you pass data that is not string type, the data will be converted to string values before concatenating.

--

--

Nk Rafi
Nk Rafi

Written by Nk Rafi

0 Followers

Tech writer. Bridging complex tech and plain language. Passionate about innovation. Educating and inspiring readers to stay ahead.

No responses yet