I'm trying to style a button
with a loop through the object's keys and values.
Values are working but keys are not.
let btn = document.querySelector('.button');
let obj = {color: 'red'}
Object.keys(obj).map(f=>btn.style.f = obj[f])
So, finally it would render like this btn.style.color = 'red'
but btn.style.f
, f is not taking but if replace the f
with color
then it's working.
Any help.