- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the best way to concatenate strings in JavaScript?
The best and fastest way to concatenate strings in JavaScript is to use the + operator. You can also use the concat() method.
Example
You can try to run the following code to concatenate strings in JavaScript
<html> <head> <title>JavaScript Concatenation</title> </head> <body> <script> var str1 = "Hello"; var str2 = "World"; var res = str1 + str2; document.write(res); </script> </body> </html>
Advertisements