Stop moving object

Hi, i am making an endless runner 2d game:

When i jump i do this :

                jump = true;
				anim.SetTrigger("Jump");				
				// Add a vertical force to the player.
				
				if(Mathf.Abs(rigidbody2D.velocity.y) <= 1)
					rigidbody2D.AddForce(new Vector2(0f, jumpForce));

				grounded = false;
				anim.SetBool("Ground",grounded);

But if i press right arrow i need to stop the y moving of the player, how can i do ?

Thank you

if (Input.GetKeyDown(KeyCode.RightArrow)) {
Vector3 v = rigidbody2D.velocity;
v.y = 0.0f;
rigidbody2D.velocity = v;
}

This assumes C#. You can directly assign it like @agoManco Capac suggests in Javascript/Unityscript.