I solved a kata on CodeWars and was looking through some of the other solutions when I came across the double asterisk to signify to the power of. I have done some research and can see that this is a valid operator in python but can see nothing about it in JavaScript documentation.
var findNb = m =>
{
var n = Math.floor((4*m)**.25);
var sum = x => (x*(x+1)/2)**2;
return sum(n) == m ? n : -1;
}
Yet when I run this solution on CodeWars, it seems to work. I am wondering if this is new in ES6, although I have found nothing about it.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…