- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Method to check if array element contains a false value in JavaScript?
To check if array element contains a false value, you can use the Object.values() in JavaScript. Following is the code −
Example
const details = [ { customerDetails: [ { isMarried: true }, { isMarried: true } ] }, { customerDetails: [ { isMarried: true }, { isMarried: true } ] } ] const isNotMarried = Object.values(details) .some(({customerDetails})=>customerDetails.some(({isMarried})=>!isMarrie d)); console.log(isNotMarried);
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo75.js.
Output
This will produce the following output −
PS C:\Users\Amit\JavaScript-code> node demo75.js false
Advertisements