Won't loop animation (solved!)

I want these animations to loop on button press. They are set to loop on the model, and even in the Animation component every animation wrap mode is set to loop. But these will only make them play the first frame and then return to idle. Here’s my code:

function Update (){
  
  if(Input.GetKeyUp("n")){
  animation.Play("sit");
  //sit using N
  }
  
  if(Input.GetKeyDown("m")){
  animation.Play("stand_001");
  //stand using M
  }
  
  if(Input.GetKeyDown("v")){
  animation.Play("sleeps"); 
  // sleep on V
  }
  }

If I try

if(Input.GetKeyDown("b")){
animation("sit").wrapMode = WrapMode.Loop 
animation.Play("sit")

it brings up and error saying

Assets/AnimalIdles.js(6,3): BCE0077: It is not possible to invoke an expression of type ‘UnityEngine.Animation’.

I’m at a loss

Try something like this:

if(Input.GetKeyDown("b")) {
    var clip = animation.GetClip("sit");
    clip.wrapMode = WrapMode.Loop;
    animation.Play("sit");
}

I solved it!! It turns out, Third Person Controller disables the animations. So using a bool, I was able to disable the Third Person Controller component every time an animation plays.