The _.without() function is used to return a copy of array which contains all the array except values.
_.without( array, *values )
Parameters: This function accepts two parameter which are listed below:
- array: This parameter is used to hold the list of array elements.
- values: This parameter is used to hold the value which need to remove from the list of array.
Return value: It return a copy of array without mentioned elements of the passed array.
Passing a list of numbers to _.without() function: The ._without() function takes the element from the list one by one and checks whether it is the unnecessary element mentioned in the second parameter or not. If it is, then it is not included in the resultant array otherwise it is included.
Passing the false elements to _.without() function: The ._without() function responds similarly by taking the element from the list one by one and checks whether it is the unnecessary element mentioned in the second parameter or not. If it is, then it is not included in the resultant array otherwise it is included. It does not bother whether it is a true element or not. This implies the_.without() function takes all the elements equally while processing.
Passing the case sensitive element (upper/lower case) to _.without() function: The ._without() function will works the same. In this function passing the element which is present in the given array in case sensitive (uppercase) format. It is not excluded from the resultant array which means that the _.without() function is case sensitive.
Passing the element in the same case to the _.without() function: Passing the second parameter as mentioned in the passed array then the element (“AJAX” here) gets excluded.
Note: These commands will not work in Google console or in Firefox as for these additional files need to be added which they didn’t have added. So, add the given links to your HTML file and then run them.
- PHP | Separate odd and even elements from array without using loop
- PHP | Print the last value of an array without affecting the pointer
- How to break line without using <br> tag in HTML / CSS ?
- Create an unordered list without any bullets using CSS
- XSS Prevention : Without Writing Single Line of Code
- How to load notification alert on top right corner without click of button in bootstrap ?
- How to set cursor style to pointer for links without href ?
- If we delete cookies of a site, we can still logged in without logging again
- How to select all elements without a given class using jQuery ?
- How to disable scrollbar without hiding using jQuery ?
- How to set attribute without value using jQuery ?
- How to create a date with a set timezone without using a string representation?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.