'Collatz conjecture

I am trying to make the Collatz conjecture in JS but I have a problem and I do not understand it. When I click on the button it return me 0, can someone help me please?

My js code:

let input   = document.getElementById('nombre');
let btn     = document.getElementById('submit');
let output  = document.getElementById('output');
let coups;

let nombre = input.value;

function conjecture() {
    do {
        if (nombre%2 === 0) {
            nombre /= 2;
            output.innerHTML += nombre + '<br>';
            coups ++;
        } else {
            nombre *= 3;
            nombre ++;
            output.innerHTML += nombre + '<br>';
            coups++;   
        }
    } while (nombre>1);

    output.innerHtml += `La courbe a atterit en ${coups} coups.<br>`; 
}

btn.addEventListener('click', conjecture);


Solution 1:[1]

Do all n positive integer values return to integer 1 for the following system of complex equation:

5n +1 if n=odd
n/2 if n=even
Not all n positive integers return to 1, only the values represented return to 1.
For the 5+1 complex system under the odd and even conditions above, this image

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ouflak