3 ms·
Shorter version (which actually checks for 0⁰ × 1¹ × 2² × 3³ × 4⁴ × 5⁵): > [0, 1, 2, 3, 4, 5].map(Math.pow).reduce((a, b) => a * b) === 1000 * 60 * 60 * 24 tr
by progval 9y ago
Shorter version (which actually checks for 0⁰ × 1¹ × 2² × 3³ × 4⁴ × 5⁵):
> [0, 1, 2, 3, 4, 5].map(Math.pow).reduce((a, b) => a * b) === 1000 * 60 * 60 * 24
true
- vortico 9y agoa=1;for(i=1;i<=5;i++)a*=Math.pow(i,i);a === 1000 * 60 * 60 * 24 a=1;i=1;while(i++<5)a*=Math.pow(i,i);a === 1000 * 60 * 60 * 24
- TekMol 9y agoEven shorter version that simply does the calculation from the title of this post: 5**5*4**4*3**3*2**2*1**1===24*60*60*1000 true
- vortico 9y agoNice ES7. But if we're not constrained by leaving 5 as a "general" number, then 864e5 === 24 * 60 * 60 * 1000