我試圖使該組織從谷歌張RFID掃描器衝插件程序...if語句,即使失敗,當變量匹配
當我去匹配掃描[I]與員工姓名[ j]它永遠不會成功。
我有一個簡單的if語句:
//names[i] is the name of the card for the scan event (card names = employee full name)
var name = names[i];
//the j for loop will check all employee names in the list for a match
var employee = employees[j];
if (name==employee) {
var ifsuccess = true;
}
但我從來沒有ifsuccess到=真...這可能是顯而易見的,但我從來沒有這樣做之前,谷歌腳本編程(或javascript:P)不任何人都知道我做錯了什麼?
也許你是由JavaScript平等善良咬傷:http://stackoverflow.com/questions/359494/javascript-vs-does-it -matter-which-equal-operator-i-use name ===員工可能會訣竅 – rene 2013-03-23 18:03:11
@rene如果'a == b'永遠不會成功,那麼是什麼讓你認爲'a === b',更具體有條件的,會做得更好嗎? – 2013-03-23 18:07:31
@rene平等永遠是真理 - ===的真實情況對於==總是如此。 – Barney 2013-03-23 18:09:09