How do I read the following code?

I am a person who want to understand n can explain myself to get what is going, recently I was doing VueJS course and came across a method which confused me, it is as following
The thing I do not understand is where is the return value being stored. From my understanding

const hello = function(){
 return 'say hello'

so the say hello will the result of const hello but when I see return function inside of a return it confuses me, as to where the value of return is stored.


here the function is not executed, instead the function is stored inside hello, to be used later. To call the function one needs to do hello() and this will return 'say hello'

in the screenshot you defined there are two things going on that may confuse you: there is a method being defined, the filteredBlogs is a function created in an object, so it is a method of that object.
Inside this method there is the filter method used on this.blogs, the filter method takes a function as argument, and returns an array containing a part of the arrays in the array on which it is used: each element of the starting array is checked using the function passed in to the filter method, and if it returns true, it is kept, if it returns false it is not kept

If you feel that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at

I am also learning through FCC but still I get stuck on complex things like these. In the above problem, what I fail to understand where is the value of each return stored.

Hey, does this make more sense?

filterBlogs: function () {
  const filteredBlog = this.blogs.filter((blog) => {
    return blog.title.match(

 return filteredBlog
1 Like

def. does coz the way I know it/learned is the value of return value is always saved on variable on right, so in ur example filterBlogs is result of filteredBlog, correct? so why the other way look complex and just returning and not storing it in a variable

They both do the same thing just written differently. There’s basically no need to save the the value in a variable since you’ll be returning that value as the output of the function. And when the function is done running, the variable will disappear from the memory. It really depends on how you like to write your code.

We can go step by step:

  • We have a list of blogs and we want to find a specific one
  • We we use Array.prototype.filter to find it.
  • Array.prototype.filter always returns a value
  • We put our code inside of a function to call it when applicable
  • Functions should a return something too. So now we have two returns. Which is the code that you showed at first.

So in the code you posted, the function is just returning the Array.prototype.filter as its output and the filter returns its own thing.