-9

So this is basically the question im working on and i know its simple but for some reason i cant figure out what im doing wrong.

Complete the function concatenateTwoStrings. This function will take in two string parameters, and should return a string which is the result of concatenating the two input strings together.

//var output = concatenateTwoStrings("stair", "case");

console.log(output); // "staircase"//


The following text is already inside the input box.

function concatenateTwoStrings(string1, string2) {

// your code here } But what im really wondering about is not as much the code but where to put it. Do i leave the curly braces and delete everything else? Also the function that is already placed in the input text area beforehand doesnt seem right anyway. Isnt the correct function name .concat() and not what the prep course has above?


I was under the impression that this particular function was suppose to be... .concat()

1 Answers1

0

A few possible options to consider:

output = "stair" + "case";
output = "stair".concat("case");
output = String.prototype.concat("stair","case");
output = String.prototype.concat.apply("", ["stair","case"]);
output = ["stair","case"].join('');
James McGuigan
  • 7,542
  • 4
  • 26
  • 29