value为一个对象
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
function showCase(value){
debugger;
switch(value){
case 'A':
console.log(' Case A');
break;
case 'B':
console.log(' Case B');
break;
case undefined:
console.log(' undefined');
break;
default:
console.log('do not know');
}
}
showCase(new String('A'));
</script>
</body>
</html>
运行结果:
do not know