Reputation: 3889
I have a switch statement like this:
switch (selectedValue1 ){
case 'قطع از بالا':
switch(selectedValue2){
case 'سیگنال خرید':
console.log(this.ngxService.period1);
switch(this.ngxService.period1){
case 6:
console.log('This is case 6' , this.ngxService.period1);
The first log message works and I can see 6
in the console, but I don't know why I can't see the second log message and it doesn't work?
Upvotes: -1
Views: 785
Reputation: 9355
If this is a string: this.ngxService.period1
, then change it to number:
switch(Number(this.ngxService.period1))
6 as string value does not match the case 6 which is number as they are two different types. Cast the 6 string to a number.
Upvotes: 4