What is concatenation?

August 17th, 2009 by uCertify Leave a reply »

Concatenation is the process of joining two or more strings. Strings can be joined in three ways:

  1. + operator
  2. += operator
  3. concat function

Each of them is shown with an example as follows:

  1. The + operator
  2. The + operator can be used to concatenate the strings as follows:

    var name=”John”
    alert(”My name is “+name)

    The output is shown in the image below:

  3. The += operator
  4. The += operator can be used as follows:

    var tag=”<html>”
    tag+=”<head><title>My web page </title></head>”
    tag+=”<body><p>This is my first web page </body>
    tag+=”</html>”

    The output is shown in the image below:

  5. The concat function
  6. The concat function belongs to a string object and it can be used to combine strings. The following code will demonstrate this:

    var str=”This is my string “.concat(”This is your string”)

    The output is shown in the image below:

Click here to get free master-ciw-web-site-manager Master CIW Web Site Manager exam practice questions. Click here to get free 1D0-435 JavaScript Fundamentals exam practice questions.
Like this article? Share it with others
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.
  • Share/Bookmark
Advertisement

Leave a Reply

uCertify.com | Our Company | Articles | Contact Us | News and Press Release | uCertify India | Entries (RSS)
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD    Cisco Certification: CCNA, CCENT    A+, Network+, Security+ Project+
Oracle Certification: OCP 11g, OCP 10g, OCA 11g, OCA 10g    CIW foundation    EC-212-32,    CISSP    Photoshop ACE CS4    Adobe Flash ACE, PMP, CAPM
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.