Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to get data from a JavaScript Object Literal
- this.objName = {
- fn : function () {console.log("????");}
- }
- this.objName.fn() // objName
- this.ns = {};
- this.ns.objName = {
- fn : function () {
- for (var k in ns)
- if (this === ns[k]) {
- alert(k);
- return;
- }
- }
- }
- this.ns.objName.fn(); // objName
- var Obj = new function() {
- this.objName = {
- id: 42,
- makeLink: function () {
- var self = this;
- document.getElementById("someelement").onclick = function(e) {
- alert(self.id); // 42
- };
- }
- }
- }
- this.objName.fn()
Add Comment
Please, Sign In to add comment