How do I link a button with an Animation?

I am using javascript, and a mac. It is also the unity free version. I have tried stuff like:

if(Input.GetButton(“sprint”)
animation.Play(“SprintAnim”)

and also:

if(Input.GetButton(“sprint”)
PlayerAnimSec.animation.CrossFade(“SprintAnim”)

neither have worked.

if(Input.GetButton(“sprint”)){
animation.play(“sprint”);
}