+ 1

How to fix this code?

My code is showing an error of a variable being not identified. I have an input box in html and I used getElementById() to get that element in a variable h1 and perform various operations on its value but it is showing that h1 is not defined. Why? I can't fix it even I tried my best. Please somebody tell what is wrong in my code. This is my code | | \/ https://code.sololearn.com/Wj0etkhlq2LI/?ref=app

28th Mar 2020, 1:06 PM
Vasu Vijay
Vasu Vijay - avatar
1 Answer
+ 1
variables declared with `var` have function level scope. If you define variable within function it's local to that function and can't be accessed outside. Now try to think how can you solve this.
28th Mar 2020, 1:16 PM
šŸ‡®šŸ‡³OmkaršŸ•‰
šŸ‡®šŸ‡³OmkaršŸ•‰ - avatar