How can i fix this weird error

I have this script so when i click space the character whould reach up and take a sword off his back, and when i click space i get this wierd error:

NullReferenceException: Object reference not set to an instance of an object walker.Update () (at Assets/my scripts/walker.js:22)

this is my script:

if(Input.GetButtonDown("Jump"))
    {
        var animationComp : Animation[] = gameObject.GetComponentsInChildren(Animation)  as Animation[];  
        for (var animComp : Animation in animationComp) 
        {         
            animComp.Play("grab sword");

        }
    }

whats wrong?

my first question dose he at least take the sword out or dose it just give you the error right of the bat i would say if he is not taking out the sword at all it is most likely since this is java script that java script dose not know it as jump it knows it as space bar try this and tell me your result i hope this helps.

Your codes says `var` it should be this:

if(Input.GetButtonDown("Jump"))
    {
        var animationComp : Animation[] = gameObject.GetComponentsInChildren(Animation);
        for (animComp in animationComp) 
        {         
            animComp.Play("grab sword");
        }
}

For a complete list of differences from C# to JS, see this post: http://answers.unity3d.com/questions/5507/what-are-the-syntax-differences-in-c-and-javascript

Edit: Oops, Don't Regularly use JavaScript, so I forgot to add `var` keyword... :)