5. What happens when you try to access
the value of an undefined variable ?
Answers
Answered by
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
Similar questions
Biology,
6 months ago
Math,
1 year ago
Math,
1 year ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago