Khan / Khan/live-editor

Program doesn't reflect changes in global variable named "length"

Open
#310 5 comments 0 reactions 0 assignees View on GitHub
bug pjs
Dominant language
JavaScript
Stars
776
Forks
180
PR merge metrics
No merged PRs in 30d

Description

Reported in ZenDesk:
https://khanacademy.zendesk.com/agent/tickets/92411

When a global variable is named length and the value is changed, the new value isn't reflected.
This would have to do with our injectCode function.

```
var length = 0; //only works with name "length" and a numerical value (stranger if value = "").
draw = function() {
background(0,0,0);
text(length+"\n"+"some text after",10,10,400,400);
};
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the example with a global variable named length, then trace the injectCode function to find where the value is captured or displayed. Verify the fix by changing length and confirming the rendered text updates to the new value.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.