Javascript help

I'm not sure whether to put this question in this forum or on StackOverflow, so...
I've recently decided to start learning javascript, and I decided to try making a custom block I had previously made using blocks by instead using a javascript function.
The function would return the index number of (string) in (array).
My script is as follows:

javascript function [index], [array]

for (var i=0, i < array.length, i++) {
if (array[ i ] === index) { 
return i }
return ' '

When I run this, it returns "Inside: SyntaxError Unexpected Token <".
What am I doing wrong?
If there's anything besides my issue that I'm doing wrong, feel free to tell me. I want to learn this language the right way, so I'm open to anything.

Use semicolon instead of comma after var i=0 and i < array.length.

Thank you so much! It works just as I hoped now.

make sure they are in english and no spaceing in a word.
yes:for ,
no:f o r ,