Power Function in JavaScript
Level 128 keystrokes
Uses Math.pow() to print 2 raised to the power of 3, which is 8.
JavaScript code
// Math.pow(base, exponent) multiplies the base by itself exponent times// 2 * 2 * 2 = 8; the ** operator does the same: 2 ** 31console.log(Math.pow(2, 3));Output
8
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
.× 2(× 2)× 2,× 1;× 1