---
title: "Discussion on \"Match arrays in JavaScript\" | Hashnode"
description: "Discussion on \"Match arrays in JavaScript\". Check if array A has all elements of array B\nlet a = [1,2,3], \n    b = [1,2,3,4], \n    c = [1,2];\n\nlet checkEvery = (arr, target) => target.every(el => arr.includes(el));\n\nconsole.log(checkEvery(b, a))       // true\nconsole.log(checkEvery(c, a))     ..."
url: "https://hashnode.com/posts/match-arrays-in-javascript/5ffda0ebb00f7510ee957da0"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Match arrays in JavaScript](https://dhruvangg.hashnode.dev/match-arrays-in-javascript?utm_source=hashnode&utm_medium=feed)

Check if array A has all elements of array B let a = \[1,2,3\], b = \[1,2,3,4\], c = \[1,2\]; let checkEvery = (arr, target) => target.every(el => arr.includes(el)); console.log(checkEvery(b, a)) // true console.log(checkEvery(c, a)) ...

Jan 12, 2021 · 1 min read · dhruvangg.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#array-methods](https://hashnode.com/tag/array-methods)
-   [#logic](https://hashnode.com/tag/logic)

## Written by

[Dhruvang Gajjar](https://hashnode.com/@dhruvang)

@dhruvang · Ahmedabad, India

  
[View profile](https://hashnode.com/@dhruvang)

JavaScript Developer @Uplers

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
