最赞回答 / 瓦洛佳YUP
function mytype(val){ if(typeof val === "string"){ console.log('字符串'); }else if(typeof val === "number"){ console.log("数字"); }}mytype("");
2021-11-01
<input type="button" value="改变颜色" onclick="chang(0)" >
<input type="button" value="改变宽高" onclick="chang(1)">
<input type="button" value="隐藏内容" onclick="chang(2)">
<input type="button" value="显示内容" onclick="chang(3)">
<input type="button" value="取消设置" onclick="chang(4)">
<input type="button" value="改变宽高" onclick="chang(1)">
<input type="button" value="隐藏内容" onclick="chang(2)">
<input type="button" value="显示内容" onclick="chang(3)">
<input type="button" value="取消设置" onclick="chang(4)">