<div class="jb51code"> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:js;"> var a = [1,2,4,32,128]; var b = []; for(var i=0;i<a.length;i++){ var index = Math.log(a[i])/Math.log(2); b.push(index); } //b = [0,1,2,5,7];</pre><div class="contentsignin">登入後複製</div></div> </div>