var fnTest = /xyz/.test(function(){xyz;}) ? /b_superb/ : /.*/;對于其中正則表達式匹配函數test的用法,我很是迷惑: /xyz/.test(function(){xyz;})我查閱了Mozilla developer center中關于test函數的描述: Executes the search for a match between a regular expression and a specified string. Returns true or false. 字符串中是否有匹配正則表達式的子字符串。返回true或false。 其語法格式: regexp.test([str])注意這里的參數是字符串,根本沒有提到test函數的參數可以是函數的說法。 我試著修改這段奇怪的代碼,得到了一些運行結果: