Hello!
So throughout my javascript learning, I’m doing my best to use varying syntax when possible to boost my practice. I.e. function syntax vs arrow syntax. Or onevent() addEventListener().
However often I find code academy might answer my task as incorrect, or in other cases, it will mark me as correct, but the program won’t run as expected.
Here is a simple example where I am having problems:
In https://www.codecademy.com/courses/build-interactive-websites/lessons/dom-events/exercises/key-events
I have written the following code, but the ball isn’t bouncing as desired. Am I missing something?
let ball = document.getElementById("float-circle");
// Write your code below
function up() {
ball.style.bottom = "250px";
}
let down = () => {
ball.style.bottom = "50px";
};
document.onkeydown = up;
document.addEventListener('keyup', down);```