JS Built-ins
StringString.prototype.concatbeginner

String.prototype.concat() β€” join two strings

πŸ“– Usage Example
const str = 'Hello'
str.concat(', ', 'World', '!')   // β†’ 'Hello, World!'
''.concat('a', 'b', 'c')          // β†’ 'abc'

Use concat() to join two or more strings together, returning a new string without modifying the originals.

String.prototype.concat()

str.concat(str2, str3, ...) returns a new string that is the combination of the given strings. It does not modify the original.

Challenge: Implement joinTwo(a, b) using .concat().

joinTwo('Hello', ' World') // β†’ 'Hello World'
πŸ’‘ Hints (1)
  • β€’ `.concat()` returns a new string without mutating the original.