how to flip a character in unity code example

Example 1: how to make player flip when pressing a d unity 2d

void  Update ()
    {  //This short code makes player flip when the A and D or arrow keys are pressed.

        Vector3 charecterScale = transform.localScale;
        if (Input.GetAxis("Horizontal") < 0)
        {
            charecterScale.x = -10;
        } 
        if (Input.GetAxis("Horizontal") > 0)
        {
            charecterScale.x = 10;
        }
        transform.localScale = charecterScale;
    }

Example 2: unity mirror character

if (isRight == true && isLeft == false) {         transform.eulerAngles = new Vector3(0, 0 ,0);   }   if (isRight == false && isLeft === true) {         transform.eulerAngles = new Vector3(0, 180, 0);   }