let value = 'italic';
let varname = "fontSizeTitle";
eval(varname + "=" + value);
console.log(fontSizeTitle)
I have a big project in which i use eval()
to assign dynamic variables to dynamic strings. The problem here is it throws an error saying italic is not defined
but when if i want to use value as a string but again being dynamic? how do i tell eval()
that i want the value
to be dynamic. Sorry for not posting my project code but its the exact scenario in here too.