Why do these functions execute automatically? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 3

Why do these functions execute automatically?

Hey everyone, I just got done making a short little program, and it works great, but I was wondering why the button functions execute when the page loads. I know the type function does because I wanted it to be that way, but shouldn't the button functions execute only when you press the button? If I did something wrong, please let me know, thanks in advance https://code.sololearn.com/Wj08FS8TYDSe/?ref=app

3rd Feb 2018, 9:06 PM
jacksonofgames 28
jacksonofgames 28 - avatar
3 Respostas
+ 9
They execute when the page loads because you call them immediatly: at the end of your code you wrote: show(); enter(); which means these functions will be executed If you want them to work only when a button is clicked, then just remove these two lines I just mentionned
3rd Feb 2018, 9:10 PM
Dapper Mink
Dapper Mink - avatar
+ 9
You're welcome :)
3rd Feb 2018, 9:20 PM
Dapper Mink
Dapper Mink - avatar
+ 3
Oh, thank you!
3rd Feb 2018, 9:18 PM
jacksonofgames 28
jacksonofgames 28 - avatar