Computer Science, asked by tanishq969, 9 months ago

5. What happens when you try to access
the value of an undefined variable ?​

Answers

Answered by pushpakala086
10

Ignoring your code for a minute, at a language level you will get that error for any object property you haven't assigned a value to.  JavaScript is dynamic, so you can add and remove object properties at runtime ( unless you freeze them ).  So if you say var cat = {color: 'black'}; // instantiate a new object with a single property called color

You'd get an error trying to access the cat object's color property because cat itself was never defined.


tanishq969: bro its not java script it's python
tanishq969: please bro tell me answer according. to python
pushpakala086: sorry
Similar questions