有人可以向我解释一下这个 JS 速记代码:
navigator.sayswho = (function(){
var N= navigator.appName, ua= navigator.userAgent, tem;
var M= ua.match(/(opera|chrome|safari|firefox|msie|Trident)\/?\s*(\.?\d+(\.\d+)*)/i);
if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
M= M? [M[1], M[2]]: [N, navigator.appVersion,'-?'];
return M;
})();
该代码正在运行,但我无法理解它是如何工作的,尤其是这一行:
M= M? [M[1], M[2]]: [N, navigator.appVersion,'-?'];