-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()

2
  • function concatenateTwoStrings(string1, string2) {retrun string1.concat(string2) } Commented May 1, 2020 at 11:43
  • 4
    When you teacher writes "your code here" he probably means you need to write it. Commented May 1, 2020 at 11:44

1 Answer 1

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('');
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.