I want to generate an addition equation for a random number which is look likes
5+10+2 from a set of numbers i.e [1,2,5,10,50].
var randomNumber = Math.floor(Math.random() * (10 - 1 + 1)) + 1;
var setOfNums = [1,2,5,10,50];
var additionEquation; //ex: for randomNumber = 28; additionEquation = 10+10+5+2+1;
And the maximum number of elements in equation is 5.Is it possible in java script?Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire