{"action":"created","issue":{"url":"https://api.github.com/repos/codecombat/codecombat/issues/1364","repository_url":"https://api.github.com/repos/codecombat/codecombat","labels_url":"https://api.github.com/repos/codecombat/codecombat/issues/1364/labels{/name}","comments_url":"https://api.github.com/repos/codecombat/codecombat/issues/1364/comments","events_url":"https://api.github.com/repos/codecombat/codecombat/issues/1364/events","html_url":"https://github.com/codecombat/codecombat/issues/1364","id":38319771,"number":1364,"title":"Dungeon Arena: Cannot assign to read only property 'myVar' of Yugargen","user":{"login":"hfarrow","id":88125,"avatar_url":"https://avatars.githubusercontent.com/u/88125?v=3","gravatar_id":"","url":"https://api.github.com/users/hfarrow","html_url":"https://github.com/hfarrow","followers_url":"https://api.github.com/users/hfarrow/followers","following_url":"https://api.github.com/users/hfarrow/following{/other_user}","gists_url":"https://api.github.com/users/hfarrow/gists{/gist_id}","starred_url":"https://api.github.com/users/hfarrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hfarrow/subscriptions","organizations_url":"https://api.github.com/users/hfarrow/orgs","repos_url":"https://api.github.com/users/hfarrow/repos","events_url":"https://api.github.com/users/hfarrow/events{/privacy}","received_events_url":"https://api.github.com/users/hfarrow/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/codecombat/codecombat/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-07-21T16:30:16Z","updated_at":"2016-05-22T17:34:54Z","closed_at":"2016-05-22T17:34:54Z","body":"In the following example script, I have an object defined as `this.myObject = {myVar=false};`. `this.myObject.update()` attempts to change the value of `myVar` which throws the error \"*Cannot assign to read only property 'myVar' of Yugargen*\"\r\n\r\nThis does not seem like intended behaviour. `myVar` should not be protected. Here is the script in it's entirety:\r\n\r\n```javascript\r\nif(!this.initialized)\r\n{\r\n    this.initialized = true;\r\n\r\n    this.myObject = {myVar:false};\r\n\r\n    // The line below will cause the same error if we remove myVar:false from above.\r\n    //this.myObject.myVar = false;\r\n\r\n    this.myObject.update = function()\r\n    {\r\n        // Cannot assign to read only property 'myVar' of Yugargen\r\n        this.myVar = true;\r\n    };\r\n}\r\n\r\nthis.myObject.update();\r\n```\r\n\r\nOne partial work around for this issue is below. With the addition of `this.myObject.init()` to initialize `myVar` to false. This almost works, except that at time=00.2 (first run of script)  `msg`  it equal to \"*undefined:undefined:undefined:*\". I would have expected it to equal \"*undefined:false:true*\". On the next run of the script, it correctly prints \"true:true:\".\r\n\r\n```javascript\r\nvar msg = \"\";\r\nif(!this.initialized)\r\n{\r\n    this.initialized = true;\r\n\r\n    this.myObject = {};\r\n\r\n    this.myObject.init = function()\r\n    {\r\n        this.myVar = false;\r\n    };\r\n\r\n    this.myObject.update = function()\r\n    {\r\n        this.myVar = true;\r\n    };\r\n    \r\n    msg += this.myObject.myVar + \":\";\r\n    this.myObject.init();\r\n}\r\n\r\n\r\nmsg += this.myObject.myVar + \":\";\r\nthis.myObject.update();\r\nmsg += this.myObject.myVar + \":\";\r\nthis.say(msg);\r\n```"},"comment":{"url":"https://api.github.com/repos/codecombat/codecombat/issues/comments/220845122","html_url":"https://github.com/codecombat/codecombat/issues/1364#issuecomment-220845122","issue_url":"https://api.github.com/repos/codecombat/codecombat/issues/1364","id":220845122,"user":{"login":"nwinter","id":99704,"avatar_url":"https://avatars.githubusercontent.com/u/99704?v=3","gravatar_id":"","url":"https://api.github.com/users/nwinter","html_url":"https://github.com/nwinter","followers_url":"https://api.github.com/users/nwinter/followers","following_url":"https://api.github.com/users/nwinter/following{/other_user}","gists_url":"https://api.github.com/users/nwinter/gists{/gist_id}","starred_url":"https://api.github.com/users/nwinter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nwinter/subscriptions","organizations_url":"https://api.github.com/users/nwinter/orgs","repos_url":"https://api.github.com/users/nwinter/repos","events_url":"https://api.github.com/users/nwinter/events{/privacy}","received_events_url":"https://api.github.com/users/nwinter/received_events","type":"User","site_admin":false},"created_at":"2016-05-22T17:34:54Z","updated_at":"2016-05-22T17:34:54Z","body":"Should be fixed with @basicer's new Esper interpreter."}}
{"actor":{"display_login":"nwinter"}}