What is concatenation?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

What is concatenation?

Rating:

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:


Rating:



Other articles

Click here to Article home

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