Javascript: concatenation string function concat ()

Source: Internet
Author: User
Javascript: concatenation String function concat () String. prototype. concat ()

The concat () method concatenates one or more strings with the original string to form a new string and return it without affecting the original string.

Syntax

str.concat(string2, string3[, ..., stringN])

Parameters

string2...stringN

Multiple strings connected to the original string

Description

The concat method concatenates one or more strings with the original string to form a new string and return it. The concat method does not affect the original string.

Example

The following example demonstrates how to combine multiple strings with the original string into a new string.

var hello = "Hello, ";console.log(hello.concat("Kevin", " have a nice day.")); /* Hello, Kevin have a nice day. */

Performance

We strongly recommend that you use the value assignment operator (+, + =) instead of the concat method.

Browser compatibility

Full platform support.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.