This part is written in English.




Código que não funcionou:


                const button = document.querySelector('input');
                const paragraph = document.querySelector('p');
                
                button.addEventListener('click', updateButton);
                
                var phone = document.getElementById("phone");
                phone.addEventListener('focus', phoneMask);
                
                function phoneMask() { 
                var num = $(this).val().replace(/\D/g,''); 
                $(this).val(num.substring(0,1) + '(' + num.substring(1,4) + ')' + num.substring(4,7) + '-' + num.substring(7,11)); 
            }