0

what is 'this keyword representing in the following code'?

function changeColor() { const color = document.getElementById("colorPicker").value; this.style.background = color; }

1st Apr 2020, 7:16 PM
Ismail Al-Nuaimi
Ismail Al-Nuaimi - avatar
3 ответов
0
this keyword refers to the object (i.e div element ,etc) you are trying to change.
1st Apr 2020, 7:31 PM
Jay W
0
thank you so much Jay W!
1st Apr 2020, 8:41 PM
Ismail Al-Nuaimi
Ismail Al-Nuaimi - avatar
0
You're welcome.
2nd Apr 2020, 6:34 PM
Jay W