The value of query. What is it?

  • 0
    Hello everyone, I go to JS courses, and now, I can't figure it out. What is query.
    Well, for example, here's the code:
    let filterGoods=(query)=>{
      return goods.filter(function(el){
                          return (el.length>0)&&
        (el.toLowerCase().indexOf(query.toLowerCase())>-1);
      
                          })
    }


    What is query here, and what does it do?
    JavaScript Anastasia Hunter, Jun 15, 2019

  • 1 Answers
  • 0
    query in this case is a variable - an input parameter of the function.

    This code could be written like this:

    function filterGoods(query) {
    return goods.filter( ... )
    }




    Based on the rest of the code, I will assume that this is a string - a search string for some array of goods
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!