
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the importance of _without() method in JavaScript?
_without()
This method is in the underscore.js library of javascript. It takes two parameters and removes, what are the elements present in the second array, from the first array. It doesn't bother whether the values are true or false, it checks each value one by one and proceeds the task. Make sure that it is case sensitive.
syntax
_.without( array, values);
Example
In the following example, it checks whether the values present in the second parameter are in the first parameter or not and tries to remove the available values.
<html> <body> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/0.10.0/lodash.min.js"></script> </head> <body> <script> document.write(_.without([5, 6, 4, 8, 9, 9, 0, 1], 0, 9, 1)); </script> </body> </html>
Output
5,6,4,8
In the following example, the word java is in both the first and the second parameters and even though it is not removed because the "JAVA" in the second parameter is in the capital case whereas the "java" in the first parameter is in a small case.
Example
<html> <body> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/0.10.0/lodash.min.js"></script> </head> <body> <script> document.write(_.without([5, 6, "c++", "php", "java", "javascript", 0, 1], 0, "JAVA", 1)); </script> </body> </html>
Output
5,6,c++,php,java,javascript
- Related Questions & Answers
- What is the importance of Math.trunc() method in JavaScript?
- What is the importance of _isEqual() method in JavaScript?
- What is the importance of _.union() method in JavaScript?
- What is the importance of str.padStart() method in JavaScript?
- What is importance of startsWith() method in JavaScript?
- What is the importance of Symbol.isConcatSpreadable in JavaScript?
- What is the importance of _.initial() function in JavaScript?
- What is the importance of Navigator Object in JavaScript?
- What is the importance of hygiene?
- What is the importance of Computer?
- Write the importance of shift() method in javascript array?
- What is the importance of '/g' flag in JavaScript?
- What is the importance of '/i' flag in JavaScript?
- What is the importance of Hindu rituals?
- What is the importance of operating systems?
Advertisements