@[TOC](JavaScript:实现以迭代方式在 O(log n) 时间内计算 x^n 即指数(x, n)算法)
// To calculate x^n i.e. exponent(x, n) in O(log n) time in iterative way
// n is an integer and n >= 0
// Examples:
// 2^3 = 8
// 5^0 = 1
// Uses the fact that
// exponent(x, n)
// = exponent(x*x, floor(n/2)) ; if n is odd
// = x*exponent(x*x, floor(n/2)) ; if n is even
const