I am trying to desing the color of a button depending on one input value.
Herefore i am making if clauses to change the const mycolor
depending of the input value state1
if(state1=== "good") {const mycolor="green"}
if(state1 === "medium") { const mycolor="yellow"}
if(state1 === "functional") {const mycolor="red"}
console.log(mycolor)
mycolor is not defined, because it is in the scope of the if statement. How can i get access to it?