what is 'this keyword representing in the following code'? | SoloLearn: Learn to code for FREE!

0

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

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

4/1/2020 7:16:15 PM

Ismail Al-Nuaimi

3 Answers

New Answer

0

this keyword refers to the object (i.e div element ,etc) you are trying to change.

0

thank you so much Jay W!

0

You're welcome.