0

How the answer is 50?

function func(a,b){ return a**b/b ;} alert(func(10,2)); //Ans:50

26th Jan 2023, 2:38 PM
Mohammad Tausiful Alam
Mohammad Tausiful Alam - avatar
5 Answers
+ 6
** is the exponentiation operator: 10**2/2 == 10*10/2
26th Jan 2023, 2:45 PM
Lisa
Lisa - avatar
+ 2
Thank U. I thought it was a pointer😁
26th Jan 2023, 2:48 PM
Mohammad Tausiful Alam
Mohammad Tausiful Alam - avatar
+ 2
Javascript don't give you direct access to memory location, In other word there's nothing like explicit initialization of pointers. exponential operator **: when used with numbers, it works just like the left value raised to power of the right. As you've described, it takes two operands to produce a single result a ** b = c This could be assumed as the raw version of Math.pow(a, b) function.
26th Jan 2023, 3:02 PM
Mirielle
Mirielle - avatar
0
Lisa you're right... Made the necessary adjustment. I wasnt thinking straight Ig
26th Jan 2023, 3:08 PM
Mirielle
Mirielle - avatar
0
*a is a pointer..... a** is exponential operator.... and hence (10**2)/2 == (10*10)/2
27th Jan 2023, 4:06 AM
Abhi_Raftaar
Abhi_Raftaar - avatar