Keyword Searching

Hi Everyone!

So I’m studying Javascript w/ the Javascript - Absolute beginner’s guide book from Kirupa, and I got stuck on the “Return Keyword” (page 35 on the 3rd edition).

So my code looks like this:

function getDistance(time, speed) {
let distance = time * speed;
return distance;
}
let myDistance = getDistance(10,5);

Exactly like it is on the book. But when I run this code, it does not return anything. What did I do wrong?

Thank you in advance!

1 Like

Hey mate,
There’s nothing wrong with that code.
The value of 50 is stored in the variable myDistance

To print the value in the console just console.log(myDistance)

1 Like