Basic JavaScript - Return a Value from a Function with Return

Tell us what’s happening:
Describe your issue in detail here.

Passed:timesFive should be a function

Passed:timesFive(5) should return 25**

Passed:timesFive(2) should return 10**

Passed:timesFive(0) should return 0"**

Okay so it wants my code to show, 25, 10 and 0. My code only show 10 but it still passed, is this correct or is it bugged since it let me pass. I wanna do everything correctly and learn as intended. It feels like I need much more code for it to print out 25, 10 and 0. But it only prints out one number.

Your code so far

function timesFive(num) {
  return num * 5
}

const answer = timesFive(2);
console.log(answer);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Return a Value from a Function with Return

Link to the challenge:

Do they mean that if I change the const.answer number for example instead of 2, make it 5 so it prints out 5*5 which is 25? because then it is correct. But it seems like they want me to print it out all at once?

It means that if you would call the function with a five it would multiple it by 5 and it would be 25 but if you call it with a 6 it should return 30 for example.

1 Like

Ah ok thanks for clarifying it Starstruck!

DOCTYPE html>
<html class="no-js" data-placeholder-focus="false">
    <head>

    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=0" /> 
    <meta name="mobileoptimized" content="0" />
    <title>index</title>
    <meta name="description" content="" /> 
    <meta name="keywords" content="" /> 
    <meta name="author" content="Constr" /> 

    <link rel="stylesheet" href="css/bootstrap.min.css"> 
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="css/owl.carousel.css"> 
    <link rel="stylesheet" href="css/animate.css"> 
    <link rel="stylesheet" href="css/custom.css">  

    <link rel="shortcut icon" href=""> 
    <link rel="apple-touch-icon" href=""> 
    <link rel="apple-touch-icon" sizes="72x72" href="">
    <link rel="apple-touch-icon" sizes="114x114" href=""> 

      <!--[if lt IE 9]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
      <![endif]-->

    </head>