JSFiddle - React, Tailwind, and code Playground
JavaScript
var isPP = function(n){
for(let i = 2; i <= Math.floor(Math.log2(n)); i++){
const k = Math.floor(Math.pow(n, 1/i));
if(n === Math.pow(k,i)){
return [k,i];
}
}
return null;
}