Question: I am trying to show remaining time till a certain date on a discord bot and have a function to provide the remaining time however the command to call the individual variables says the return variables are not defined.

```
function getTimeRemaining(endTime){
    const total = Date.parse(endTime) - Date.parse(new Date());
    const seconds = Math.floor((total/1000)%60);
    const minutes = Math.floor((total/1000/60)%60);
    const hours = Math.floor((total/(1000*60*60))%24);
    const days = Math.floor(total/(1000*60*60*24));
    return{
        total,
        days,
        hours,
        minutes,
        seconds
    };
};

if (command == 'time'){
    const releaseDate = 'November 14 2020'
    getTimeRemaining(releaseDate);
    message.channel.send(days + ' days, ' + hours + ' hours, ' + minutes + ' minutes, ' + seconds + ' seconds until ___.');
};

```

What needs to be changed to return the variables with defined values?

Answer: 
You were close. Your mistake was understandable though. When you called your "getTimeRemaining" function, the returned values are not actually global. You need to get each returned value by actually calling the function (with your returned value using dot notation).

Example code below with comments added.

More on return values here -------> <https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Return_values>

Hope this helps.

```html
<!DOCTYPE html>
<html>
<head>
    <title>Test</title>
</head>
<body>

</body>

<script type="text/javascript">
    function getTimeRemaining(endTime){
        const total = Date.parse(endTime) - Date.parse(new Date());
        const seconds = Math.floor((total/1000)%60);
        const minutes = Math.floor((total/1000/60)%60);
        const hours = Math.floor((total/(1000*60*60))%24);
        const days = Math.floor(total/(1000*60*60*24));
        return{
            total,
            days,
            hours,
            minutes,
            seconds
        };
    };

    const command = 'time'

    if (command == 'time'){
        const releaseDate = 'November 14 2020'

        //Just because you ran the function here it doesn't mean those returned values are global
        console.log(getTimeRemaining(releaseDate));

        //You need to actually call the function and pass what you need returned
        console.log(getTimeRemaining(releaseDate).days)

        var total = getTimeRemaining(releaseDate).total,
            days = getTimeRemaining(releaseDate).days,
            hours = getTimeRemaining(releaseDate).hours,
            minutes = getTimeRemaining(releaseDate).minutes,
            seconds = getTimeRemaining(releaseDate).seconds;

        console.log(total, days, hours, minutes, seconds);

        // message.channel.send(days + ' days, ' + hours + ' hours, ' + minutes + ' minutes, ' + seconds + ' seconds until ___.');
    };
</script>
</html>
```
```
function getTimeRemaining(endTime){
  const total = Date.parse(endTime) - Date.parse(new Date());
  const seconds = Math.floor((total/1000)%60);
  const minutes = Math.floor((total/1000/60)%60);
  const hours = Math.floor((total/(1000*60*60))%24);
  const days = Math.floor(total/(1000*60*60*24));
  return {
      total,
      days,
      hours,
      minutes,
      seconds
  };
};

if(command == 'time'){
  const releaseDate = 'November 14 2020'
  let timeRemaining = getTimeRemaining(releaseDate);
  message.channel.send(timeRemaining.days + ' days, ' + timeRemaining.hours + ' hours, ' + timeRemaining.minutes + ' minutes, ' + timeRemaining.seconds + ' seconds until ___.');
};

```

What I'm doing here is creating a new variable called `timeRemaining`. This called your function and in your function you're already returning an object. Once you have a variable that has a value of an object, you can just do .   

ie timeRemaining.day would return the day.