Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js pow

Math.pow(base, exponent);

Math.pow(2, 4);
// Outputs 16
// The same as going 2^4, 2 to the power of 4
Comment

is power javascript

function solution(n) {
    if (n === 1) {
        return true;
    }
    for (let i = 2; i < n; i++) {
        let power = i;
        while (power < n) {
            power *= i;
        }
        if (power === n) {
            return true;
        }
    }
    return false;
}
Comment

to the power of javascript

base ** exponent
Comment

define math.pow() method in javascript

// Math.pow()

// The Math. pow() method returns the value of x to the power of y (xy).

// EXAMPLE : 1
let powerOf = Math.pow(2,5);
console.log(powerOf);
// OUTPUT: 32

// EXAMPLE : 2
let powerOf2 = Math.pow(-2,5);
console.log(powerOf2);
// OUTPUT: -32

// EXAMPLE : 3
let powerOf3 = Math.pow();
console.log(powerOf3);
// OUTPUT: NaN
Comment

js pow function

var x = parseInt(prompt("Enter the base: "))
var y = parseInt(prompt("Enter the power: "))

var value = parseInt(Math.pow(x, y))

console.log(value)
Comment

javaScript Math.pow()

Math.pow(8, 2);
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript interview questions for freshers 
Javascript :: run javascript in html 
Javascript :: set onclick jquery 
Javascript :: javascript find object in array by property value 
Javascript :: save networkx graph to json 
Javascript :: generate and download xml from javascript 
Javascript :: javascript between 
Javascript :: segregate value by _ using jquery like explode 
Javascript :: How to set up ejs 
Javascript :: jest invalid or unexpected token 
Javascript :: add google analytics to react 
Javascript :: Cannot use import statement inside the Node.js REPL, alternatively use dynamic import 
Javascript :: javascript change content of h element 
Javascript :: how to add a white space in jsx 
Javascript :: learn nestjs 
Javascript :: for loop array 
Javascript :: convert json object to lowercase 
Javascript :: react native vector icons link 
Javascript :: how to replace all occurrences of a string in javascript 
Javascript :: handlebarsjs each first element 
Javascript :: socket emit to specific room using nodejs socket.io 
Javascript :: get nearest location based on latitude and longitude javascript 
Javascript :: javascript select element with two classes 
Javascript :: get json data into object 
Javascript :: nodejs delete object key 
Javascript :: json loop in js 
Javascript :: how to clear input value in antdesign form on submit 
Javascript :: vue select first option default 
Javascript :: how to change port in react js 
Javascript :: do somthing after page completly load jqery 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =