I am trying to change the value of a global variable by declaring it at the constructor and then initializing it with a value in a function. What I am trying is quite similar to the code which I have typed here. The code executes but nothing gets printed. Can someone tell me what is happening?
class Sample{
constructor(){
let joey ="";
}
fire(){
joey ="Yo";
console.log(joey);
}
}