How can I make a object use alternate Inputs?

Ok so I am trying to make my player jump using either the “W” key or the “Space” key but my player end up being controlled by the “W” key only here’s the code
Thanks in advance!

if (Input.GetKeyDown (KeyCode.W) || Input.GetKeyDown (KeyCode.Space) && onGround == true && canJump < 0) {
rb.velocity = Vector2.up * jumpForce;
canJump–;
}

Put brackets around the both Input conditions. && operator goes before the ||. So you end up having a condition which is true either when you only press W or when you press Space and have bunch of other stuff as true.

if ((Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.Space)) &&
    onGround &&
    canJump < 0)
{
    rb.velocity = Vector2.up * jumpForce;
    canJump--;
}