Currently messing about with javascript on my website. Attempted to make the background colour of the marquee element change with the string entered into the input element. The colour is initially black and seems to change after an indeterminate number of characters. After the colour has changed for the first time it seems to change to another colour after a relatively similar number of characters.
const inputbox = document.querySelector('input')
inputbox.onkeydown = (f) => document.querySelector('marquee').bgColor = (f.target.value);
Can somebody explain why this happens?