get recursion exponent power in javascript
//get recursion exponent power in javascript
//calcular potencia en javascript
const potenciacion=(base,exponente)=>{
if(exponente==1){
return base;
}
if(exponente==0){
return 1;
}
if(exponente<0){
exponente*=(-1);
return 1/(potenciacion(base,exponente-1) * base);
}
return potenciacion(base,exponente-1) * base;
}
console.log(potenciacion(2,2));
Also in JavaScript:
- Getting Nan when calculate two date js
- daysinmonth javascript
- javascript convert in a string the items of an array
- how to delete object property of array javascript
- run length encoding javascript
- kotlin read input as int
- SFC in react
- How to get row index and cellindex together in javascript
- react native length of object
- how to remove a property from an object in javascript
- uncheck checkbox when another is checked javascript
- mometjs
- get current date javascript full month
- javascript rgb to hex
- nodejs shebang
- how to wirte json format
- js create array from for loop
- react router 404 redirect
- jquery remove string from string
- pd.read_json('data.json') args
- how to install node js in ubuntu
- next js shared hosting without node js
- javascript codegolf round
- Error: There was an unhandled exception on the current circuit, so this circuit will be terminated. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSettings.Development.json' or set 'CircuitOptions.DetailedErrors'.