Have input element “follow along” as value is updated programmatically

If you run the code snippet below and type (anything) into the input, the input will “follow along” with your text input, and not just show the first few characters indefinitely.

I’m wondering if this is possible to achieve if the input value is changed programmatically, in this example, the “Update Input” button.

const updateInput = () => {
const input1 = document.getElementById('input1');
input1.value += Math.random()*1000;
}
<input id="input1" style="width:50px" />
<button onclick="updateInput()">Update Input</button>