If you copied your code verbatim and I’ll guess that you did then it is likely prefix.lenght which should be prefix.length.
If you want a developer’s hint, be very liberal with console.log messages as you try to debug things. console.log prefix, prefix.lenght, args, command, etc. to see if in each case it doesn’t generate an error and outputs what you expect. You can comment them out or remove them when you are happy that it works.