Return statement needed

ES6: Explore Differences Between the var and let Keywords:

let catName;
let quote;
function catTalk() {
  "use strict";

  catName = "Oliver";
  quote = catName + " says Meow!";


This answer is correct according to freecodecamp but its actually incorrect. A return statement is needed.

This function is just setting the value of a variable, it doesn’t need to return anything, return is not needed. There is no rule that says functions need to return a value in JavaScript.

1 Like

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.