3
I have a question, I need to do a function in Javascript that shows the 50 numbers that the sum of their digits is equal to 10, example:
Number 19, digits 1 and 9, sum of digits: 1+9 =10. The function should show me the number 19, showing a total of 50 numbers.
I was able, at first, to calculate the digits of the number, using a form, I just couldn’t develop the logic to show the 50 numbers.
function start() {
var form = document.getElementById("exercicio_8");
var x = form.num_5.value;
var y = x.toString().split("");
var soma = eval(y.join('+'));
document.getElementById("saida2").innerHTML = soma;
}
I didn’t understand how your current code works (which is the input?), nor where is the problem... Could [Edit] the question including more details?
– bfavaretto
From what he implied, he has no idea how to construct the logic to display this list with 50 nums
– Tafarel Chicotti
the input is in a form, the variable x is coming from an input, in this case, I’m typing a number in a form, example: 26, and it’s giving me the sum of the digits, 2+6 =8, but Nan has already answered the question, thanks
– CrazyNomad