Skip to main content
Table of contents

Back to challenge 6

Solution

Challenge 6: Needle in a Haystack

var findNeedle = haystack => {
    var index = haystack.findIndex(word => word === "needle");
    return `Found the needle at position ${index}`;
}

Back to menu

This page was last reviewed on 3 February 2022. It needs to be reviewed again on 3 February 2023 .
This page was set to be reviewed before 3 February 2023. This might mean the content is out of date.