Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
That's strange. I tried running this on a server I have running node 17.4, it prints "undefined" to my console. I see no way that it could print "found the needle at position 3" with the code that you've presented here.
I would be surprised if this worked locally at all. It would only work locally if you were printing the value instead of returning it. As it is now, your return statement doesn't really do anything because it's only returning the value to the
forEach
function, and theforEach
function doesn't really do anything with values returned to it.Please mark your comment as spoiler if you have code in it.
() => {}
is a function. Your return statement only returns in that function. Thus your main function doesn't return anything.