JavaScript Concat:- Geniusofstudent


  • The concat() method is used to join two or more strings.
  • This method does not change the existing strings, but returns a new string containing the text of the joined strings.

  • Code:-

  • <!DOCTYPE html> 
  • <html> 
  •  
  • <head> 
  •  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  • </head> 
  •  
  • <body> 
  •  
  •  <h1>concat()</h1> 
  •  
  •  <input type="button" onclick="strfun();" value="Get Answer"> 
  •  
  •  <script> 
  •   function strfun() 
  •   { 
  •  
  •    var str1 = "Testing"; 
  •    var str2 = " App"; 
  •    alert(str1.concat(" for ", str2)); 
  •   } 
  •  </script> 
  •  
  • </body> 
  •  
  • </html>
  • JavaScript Concat:- Geniusofstudent JavaScript Concat:- Geniusofstudent Reviewed by Network security on June 24, 2019 Rating: 5

    No comments:

    Useful Information

    Powered by Blogger.