I have been trying to learn java script for about a year and half. I looked into books and youtube videos but i still do not know when or where to use it.
Javascript in Unity can be added as a script and attached to GameObjects to perform certain behaviours on those objects.
For some great video tutorials on Javascript with Unity take a look at www.unity3dstudent.com
Good luck
I have been trying to learn java script for about a year and half.
Consider what may be blocking you from learning it? Do you understand basic programming concepts? If you cannot grasp the language, then you need to take a few steps back and start looking at more basic concepts that can block you from understanding Javascript (or any new language.)
I looked into books and youtube videos but i still do not know when or where to use it.
Javascript is a tool for getting a specific type of job done. You can use Javascript for anything you wish as long as you have a Javascript interpreter running in your app, or in Unity's case, it compiles your Javascript into its own special bytecode. (transparent to you). Javascript is also widely used in web programming.
Note that Unity also supports use of C# and Boo scripting languages as well, so again, (choose your tool). It doesn't have to be Javascript.