javascript - 关于es6的算法问题
阿神
阿神 2017-04-11 13:04:12
0
2
454
powersOfTwo(0) // [1]
powersOfTwo(1) //[1, 2]
powersOfTwo(4) // [1, 2, 4, 8, 16]


function powersOfTwo(n) {
  return Array.from({length: n + 1}, (v, k) => 2 ** k);
}

这里的2**k是怎么理解?

阿神
阿神

闭关修行中......

reply all(2)
迷茫

es7 特性

Exponentiation

大家讲道理

表示2的k次方

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!