Syntax

JavaScript Check if Array Includes Syntax

In JavaScript, check if array includes: checks whether an array contains a value — nums.includes(3)

Quick Answer

Syntax
nums.includes(3)
JavaScriptSyntax

Check if Array Includes

Code example
nums.includes(3)

Checks whether an array contains a value.

Learn More

How to check if array includes in JavaScript

  1. Open your JavaScript file or editor.
  2. Copy the example, then replace its sample names and values for your code.

JavaScript Check if Array Includes Syntax

Use nums.includes(3).

Related Syntax References

Frequently asked questions

What is the JavaScript syntax for check if array includes?

Use this pattern: nums.includes(3)

Can I copy this JavaScript code example?

Yes. Use Copy code and adapt the example to your program.

Is this JavaScript syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify