Why pow() function returning 1 ??? JS | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Why pow() function returning 1 ??? JS

It should return 0 but why it returns 1 on cancelling both the prompt and how can be avoid it? https://code.sololearn.com/Wx0EtgnRvw2o/?ref=app

8th Nov 2021, 8:49 PM
Himansh
Himansh - avatar
4 Respuestas
+ 1
Oma Falk i have searched more it on net and it is actually indifinite that 0^0 should be 1 or 0 in math. Hence so behaviour.
8th Nov 2021, 9:28 PM
Himansh
Himansh - avatar
+ 4
n%1 = 0 for each n x**0 = 1 for each x
8th Nov 2021, 9:05 PM
Oma Falk
Oma Falk - avatar
+ 1
Anything power 0 is equals to 1 Except 0 as input
9th Nov 2021, 6:31 AM
sree harsha
sree harsha - avatar
+ 1
Himansh but in JS it is defined as 1. That's the important one.
9th Nov 2021, 7:09 AM
Oma Falk
Oma Falk - avatar