

JS Objects Object Definitions Object Properties Object Methods Object Display Object Accessors Object Constructors Object Prototypes Object Iterables Object Sets Object Maps Object Reference Let getEvenNum = _.JS Tutorial JS HOME JS Introduction JS Where To JS Output JS Statements JS Syntax JS Comments JS Variables JS Let JS Const JS Operators JS Arithmetic JS Assignment JS Data Types JS Functions JS Objects JS Events JS Strings JS String Methods JS String Search JS String Templates JS Numbers JS BigInt JS Number Methods JS Number Properties JS Arrays JS Array Methods JS Array Sort JS Array Iteration JS Array Const JS Dates JS Date Formats JS Date Get Methods JS Date Set Methods JS Math JS Random JS Booleans JS Comparisons JS If Else JS Switch JS Loop For JS Loop For In JS Loop For Of JS Loop While JS Break JS Iterables JS Sets JS Maps JS Typeof JS Type Conversion JS Bitwise JS RegExp JS Precedence JS Errors JS Scope JS Hoisting JS Strict Mode JS this Keyword JS Arrow Function JS Classes JS Modules JS JSON JS Debugging JS Style Guide JS Best Practices JS Mistakes JS Performance JS Reserved Words In this case, we will use the _.filter() method to check whether the elements in an array have passed the condition or not. ĭocument.write(JSON.stringify(_.where(users, ))) If it’ll match, then the value will be returned. The _.where() function takes the array’s elements one by one and matches the specified condition. Example 1: Passing an array to the _.where() function Return value − the function returns all value with the matched condition. Predicate − This parameter holds the test condition. List − the parameter used to hold the list of data. The function accepts three-argument as a parameter.

So the name of all the users with the specific condition will be returned. Suppose you want to find all the user details of the class and then apply the _.where() function to the list of all the sections and pass the condition as the section name. The _.where() is a function used to find the specific element according to the given conditions. The _.where() belongs to underscore.js a javascript library that provides versatile functions. We can find the specific condition with the help of the _.whare() function.
