以下是javascript
var tmp=['taipei','taiwan','teacher','tank','top gun','ten'];
var re = new RegExp("t", "gi");
var flag;
for(var i=0;i<tmp.length;i++){
flag = re.test(tmp[i]);
$('#info').append(tmp[i]+" = "+flag+"<br />");
}
上面這段很單純
就是檢查每個單字裡面有沒有t
看起來結果應該通通是true
但結果卻是
taipei = true
taiwan = false
teacher = true
tank = false
top gun = true
ten = false
請問我的程式是哪裡有問題呢?