Which of these is the correct syntax for string concatenation in JavaScript?A. str1 + str2None of these options.Both A and B.B. str1.concat(str2)
Question
Which of these is the correct syntax for string concatenation in JavaScript?A. str1 + str2None of these options.Both A and B.B. str1.concat(str2)
Solution
The correct syntax for string concatenation in JavaScript is both A and B.
A. str1 + str2 B. str1.concat(str2)
Both of these options are valid ways to concatenate strings in JavaScript. The '+' operator can be used to add two strings together, and the '.concat()' method can be used to join two or more strings.
Similar Questions
Which method is used to merge two strings in JavaScript?
In which of the following ways can we create strings in JavaScript?A'A string'B"A string"C`A string`DAll of the above
_____ operator is used for concatenating two strings.
How will you concatenate two strings?A.Using . operator.B.Using + operator.C.Using add() functionD.Using append() function
Which of the following functions is used to concatenate two strings in C?strcat;strappend()strcat()strjoin()strmerge()
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.