Javascript little game where the ball bounces off the racket multiple times on one go

I'm making a final project in my CODEHS course, I'm trying to make a ping-pong kind of game, where the tennis ball would bounce off the racket on the screen which the user will be moving and it will just keep score of that. I have managed to make the ball bounce off the racket, but, not always, sometimes, the ball will bounce off the racket multiple times if it hits the angle in a certain way, for example, the score would be 5 and then after one bounce it will go up to 35 or something. I've been trying to figure out how to fix this issue for 2 days already and I'm looking for some advice. Here's the code for the racket :

handle = new Rectangle(HANDLE_WIDTH,HANDLE_HEIGHT);
handle.setPosition(getWidth()/2 - HANDLE_WIDTH/2, getHeight() - HANDLE_HEIGHT);
handle.setColor(Color.black);
add(handle);

head = new Circle(HEAD_RADIUS);
head.setPosition(getWidth()/2 , getHeight() - HEAD_RADIUS - HANDLE_HEIGHT);
head.setColor("#FA9905");
add(head);`

Here's the code for the ball :

function ball(){
ball = new Circle(BALL_RADIUS);
ball.setPosition(getWidth()/2, getHeight()/2);
ball.setColor("#900C3F");
add(ball);

}

Here's the code for bouncing off the wall :

function checkRacket(){

    elem = getElementAt(ball.getX() , ball.getY() - ball.getRadius());
    if(elem == head){
        
        dy = Math.abs(dy);
        
        if(ball.getX() + BALL_RADIUS >= head.getX()/4)
        elem = getElementAt(ball.getX() + BALL_RADIUS, ball.getY());
        if(elem == head){
            
            dx = - Math.abs(dx);
         
         if(ball.getX() - BALL_RADIUS >= head.getX()/4){
    elem = getElementAt(ball.getX() - BALL_RADIUS, ball.getY());
        if(elem == head){
          
            dx =  Math.abs(dx);
      
             if(ball.getY() + BALL_RADIUS >= head.getY()/4){
    elem = getElementAt(ball.getX(), ball.getY() + ball.getRadius());
        if(elem == head){
           
            dy= - Math.abs(dy);

I guess this is it, thanks in advance <3