Undefined object properties subjected to the decrement operator should throw an error
- Dominant language
- JavaScript
- Stars
- 776
- Forks
- 180
- PR merge metrics
- No merged PRs in 30d
Description
So I was working on a help request where the student did some _crazy_ things, like setting an object property equal to the image function `this.health = image(...`, and later trying to decrement the property `ship.health--;` ...and then trying to display the result in the text function. Anyways while I was messing with this program I discovered that `text(undefined--,200,200);` throws an error while `text(test.undef--,200,200);` does not even if the property is undefined. Here is a little test program (plus help request) to illustrate what I'm talking about: https://www.khanacademy.org/computer-programming/should-this-be-an-error/4778870184738816?qa_expand_key=ag5zfmtoYW4tYWNhZGVteXJpCxIIVXNlckRhdGEiRnVzZXJfaWRfa2V5X2h0dHA6Ly9pZC5raGFuYWNhZGVteS5vcmcvMWY0NjRhZTYyYjQ5NDBkZjk2NWZlYTVkNTk5ZmVlZmUMCxIIRmVlZGJhY2sYgICAgMWTgwkM
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked Khan Academy reproduction and compare decrementing an undefined variable with decrementing an undefined object property. Trace where each expression is evaluated and determine whether both cases should raise an error; done means the behavior is covered consistently by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100