SOURCE

// switch 的两种写法

// 场景一:需要在case里写表达式
let a = 12

switch(true){
    case a < 0:
     console.log('a  > 0')
     break;
     
    case a == 0:
     console.log('a  = 0')
     break;

    case a > 0:
     console.log('a  > 0')
     break;
    
    default:
     console.log('aaaaaa')
    break;
}

// 场景二:
switch(a){
    case 12:
     console.log('a  等于 12')
     break;

    default:
     console.log('a  不等于 0')
    break;
}

let height = 130 //身高
let weight = 150 //体重

n = (height - 108) * 2//体重
if(n <= weight + 10 && n >= weight-10){
    console.log('体重达标')
}else{
    console.log('体重不达标')
}
console.log('体重等于 ' + weight)



for(var i=0;i<5;i++){
   let x=''
   for(var j=0; j <=i;j++){
       x +='*'
    }
    console.log(x)
}

var a = 1
for(var i=0;i<5;i++){
    let x=''
    if(i < 3){
        for(var j=1;j<=2*i+1;j++){
            x +='*'
        }
    }else{
        let max = ((i-(2*a))*2+1)
        console.log('max-a: ' + max+'--'+a)
        for(var j=i;j>max;j--){
            x +='*'
        }
        a++;
    }

    console.log(x)
}
console 命令行工具 X clear

                    
>
console