Why do my animations flicker?

My animation is supposed to be used in my physics project that I'm doing. I'm using 10 milliseconds setInterval () Y setTimeout () and it fails inside and outside.
the setTimeout () handle the Clear() It works in my code, but I have the setTimeout () At 9 milliseconds and it works better. If someone can help me, here is the code:

var canvas = document.getElementById ("canvas")
var ctx = canvas.getContext ("2d")
var x = 10
var y = 0
var xPos = 0
var yPos = 0

updateVariables () {function
x = x * 0.9
y = y * -0.9
y = y + 1
xPos + = x
yPos + = y
}

clear function () {
ctx.clearRect (0,0,600,600)
}

Draw function () {
ctx.fillRect (xPos, yPos, 20.10)
ctx.fillRect (0,131,600.20)
setTimeout (of course, 9)
}

function collisionCheck () {
yes (yPos> 120) {
yPos = 120
}
}

function keyCheck () {
}

setInterval (Draw, 10)
setInterval (updateVariables, 1)
setInterval (collisionCheck, 10)