Ad
  • Custom User Avatar

    Hello, the array is generated with the Javascript code a=[];for(i=0;i<10;i++)a[i]=i**2;a.join(','). However, **2 is ES6 and not a very portable solution, and pre-generating the array into a const will make it less readable. This decision to pre-feed corresponding solutions into a lookup table is a balance between intuitiveness and simplicity, where for coding challenges, keeping the solution efficient and simple often makes the intention come to light better.

    Also, since the number of digits doesn't change as we're always using denary (base 10), there's no real advantage to keeping it dynamic, other than being modular.