12 January 2023

In JavaScript, the equivalent of the PHP function in_array() is the includes() method, which is used to check if an array contains a certain value.

Source code viewer
  1. ['a', 'b', 'c', 'd'].includes('c');
  2. // Console output: true
Programming Language: Javascript