Essential Types And Notations 20 exercises
Problem

Annotating Empty Parameters

Here we have a concatTwoStrings that is similar in shape to the add function. It takes two parameters, a and b, and returns a string.


const concatTwoStrings = (a, b) => {
// red squiggly lines under `a` and `b`
return [a, b].join(" ");
};

There are currently errors on

Loading exercise

Transcript

00:00 This exercise is very similar to the first. Instead of adding two numbers together, we're concatenating two strings. Inside the concat2strings function, we have a and b here, but we currently haven't given them any types. And here, down the bottom, we're calling concat2strings with hello and world, and everything seems okay.

00:18 And we're also expecting that result here is going to be a string, and it turns out that it is a string. But the error that we're getting at the top is an issue. So the error is parameter a implicitly hasn't any type. So your job is to try to work out why that error is happening, and what we can do to fix it. Good luck.