I NEED YOUR HELP GUYS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I NEED YOUR HELP GUYS

I CREATED A VARIABLE FIRST AND THEN DECLARED IT INSIDE A FUNCTION, BUT IT DOESN'T WORK, GOT thrown ERRORS INSTEAD https://code.sololearn.com/WY0nGBhi2coK/#js

29th Apr 2019, 2:34 AM
Glory222
Glory222 - avatar
2 Answers
+ 6
From all your JS only part that is inside your function will be executed. So you have to declare and initiate variables inside function myFunction() { var str = document.getElementById("massagebox").value; var sms = document.getElementById("mess"); And than use text from sms
29th Apr 2019, 5:24 AM
Dima Makieiev
Dima Makieiev - avatar
+ 5
Hey there 🙂 When you type in ALL CAPS, it means that you are shouting... ---- In order to use the variables, you will need to declare them in myFunction as Dima Makieiev had mentioned.
29th Apr 2019, 7:08 AM
Edwin Pratt
Edwin Pratt - avatar