How to determine whether the other then() methods can be omitted?
The following codes illustrate a form which allows optionally pasting the value from the clipboard before automatically submitting. It uses two then() methods. Please use Chrome to test it because Firefox does not support it yet. const input = document.querySelector(‘input’), submitButton = document.querySelector(‘button[type=”submit”]’), pasteAndSubmitButton = document.querySelector(‘button[type=”button”]’); pasteAndSubmitButton.addEventListener(‘click’, function () { navigator.clipboard.readText() .then(clipText => input.value =… Read More How to determine whether the other then() methods can be omitted?