I am learning algorithms. And I didn't find any articles about how to calculate Time Complexity of string concatenation in JavaScript.
function concatString(str1, str2) {
// return str1 + str2;
// return str1.concat(str2)
}
We can concat strings using operator '+' or using built-in method String.prototype.concat
Which method is better? What is the Time Complexity of both methods?