Please help

so I recently started using Mecanim and i wanted your help. I want to know how to make the character walk foward by pressing the ‘W’ key and it playing the foward_walk animation. I want a fairly basic javascript handmade. Please, this would be very helpful as i could not find any java script videos on Youtube

What you need is the Input class and the Animator Class documentation.
Other than that, if you follow the official macanim Tutorial, you get all the information you need to create your simple controller.

The scripts they use/you can download are in C#, but the little logic you need for your script should be identical in javascript.