Integrated Development Environments Superpowers 13 exercises
Problem

Adding Documentation for Hovers

Here's a simple function that adds two numbers together:


const myFunction = (a: number, b: number) => {
return a + b;
};

In order to understand what this function does, you'd have to read the code.

However, TypeScript allows us to add comments that will appear when the functio

Loading exercise

Transcript

00:00 Another thing that's really useful about TypeScript is it lets you build in automatic documentation for your functions and variables. What we want to do here is we have a function which is just adding two numbers together. And what I'd like you to do is by using something called JS doc comments, sometimes you'll find them as TS doc comments too,

00:19 is I want you to add a comment above the function that just describes what it does. And this is just adds two numbers together, for instance. And you'll see when you hover over that function, something very interesting will occur. Good luck.