In an Angular2 typescript component I have the following local variables
teapot10: boolean = false;
teapot20: boolean = false;
teapot30: boolean = false;
I want to use these dynamically in a function like so
doSomeStuff("teapot20")
doSomeStuff(teapot: string){
this[teapot] = true
}
So in this example I pass the string name of the local variable "teapot20" and I want to use this string to manipulate the actual variable called teapot20.
Can I do this?
Thanks
this[teapot]this[teapot]?