Skip to content
Subhajit Sahu edited this page Aug 8, 2022 · 1 revision

Check if a number is a power-of-n.

Similar: isPow, prevPow, nextPow.


function isPow(x, n)
// x: a number
// n: base

const xmath = require('extra-math');


xmath.isPow(32, 2);
// → true

xmath.isPow(32, 4);
// → false

xmath.isPow(64, 4);
// → true


References

Clone this wiki locally