KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This is the working code: var test = function () { console.log(test.data); }; test.data = 'hello'; test.set = function (data) { test.data = data; }; test.set('Test'); test(); This outputs Test to my javascript console. Now I was wondering, if there was a way to do it using something like this? var test = { this: function () { console.log(test.data); }, data: 'hello', set: function (data) { test.data = data; } };
Tags (comma-separated)
Save Edits
Cancel