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.
How to check if array includes in JavaScript
- Open your JavaScript file or editor.
- 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