Cant figure out the reason of this [Javascript, HTML ] [closed]

I am working on this 2d-shooter game, for a while. Making this game using JavaScript and html canvas. The black rect is what i refer as gun, and the yellow rect are bullets.
Gun can move left and right using ‘a’ and ‘d’ keys respectively. Bullet is shot using ‘Enter’.
The problem: 1) With each bullet shot, the speed of bullet is increasing.
2) if i move the gun right after the bullet shoot, there is a part of bullet not cleared.
Code is on my Github

I tried making an object of bullet, but it didnt go well.