HELP! p5.js Rect - Rect Collions other!

Hi, I have 2 questions that I love to have for making my own fun games like the helicopter.

see picture…

  1. Small rectangle to right bosting with large rectangle, but small rect does not stand through, how?
    stuck just like the wall you can’t walk through. stand still. with function Array / object does not work with x = x * -1 (sometimes it does, but weird x will go through by itself, I don’t want that)

  2. Padle on the top of the head like, cannot go down
    but bottom must hit.

How can I get code?
I spent so many weeks searching. what I want.

Please help ME.

Please code example:

hit = Rectcheck (x1, y1, this.x, this.y, this.w, this.h)
function Rectcheck (x, y, w, h, x1, y1, w1, h1){
here code foto 1 or 2

if u r trying to make a physics collision system of rectangles
this video might be of some help