これが私のJavascriptです:
document.getElementById('post').style.color = "black";
document.documentElement.className = "active";
alert(document.documentElement.clientWidth);
次の縮小版のどれが良いと思いますか?なんで?それらは基本的に同じ長さですが、2番目の方法は無名関数を使用していくつかの変数の名前を変更します。
速度に違いはありますか(ただし、ナノ秒は何ナノ秒になりますか)?
通常の縮小:
document.getElementById('post').style.color="#000";document.documentElement.className="active";alert(document.documentElement.clientWidth);
または無名関数を使用して...
(function(){var d=document,h=d.documentElement;d.getElementById('post').style.color="#000";h.className="active";alert(h.clientWidth)})();