math nth root javascript code example Example: javascript nth root var root = 3; var number = 27; var answer = Math.pow(number, 1 / root); // 3