diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof/index.md index f99df8bed2..c10afafa50 100644 --- a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof/index.md +++ b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-data-structures/check-for-the-presence-of-an-element-with-indexof/index.md @@ -26,3 +26,12 @@ return arr.indexOf(elem) >= 0 ? true : false; } console.log(quickCheck(['squash', 'onions', 'shallots'], 'mushrooms')); ``` +- `Solution-3` demonstrates how the problem can be solved by directly returning result of the comparison. + +## Solution-3: +```javascript +function quickCheck(arr, elem) { + return arr.indexOf(elem) != -1; +} +console.log(quickCheck(['squash', 'onions', 'shallots'], 'mushrooms')); +```