loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.29448874160897076","path":"main.js","file":{"path":"main.js","content":{"asEncoding":{"base64":"dmFyIExhbmd1YWdlID0gZnVuY3Rpb24obmFtZSx2ZXJzaW9uKSB7IAogdGhpcy5uYW1lID0gbmFtZTsKIHRoaXMudmVyc2lvbiA9IHZlcnNpb247CiB0aGlzLmhlbGxvID0gZnVuY3Rpb24oKSB7IAogICByZXR1cm4gIkhlbGxvIGZyb20gIiArIHRoaXMubmFtZTsKIH0KfTsKCnZhciBpbnN0YW5jZUxhbmd1YWdlID0gbmV3IExhbmd1YWdlKCJQeXRob24iLCIyLjciKTsKCgp2YXIgbGl0ZXJhbExhbmd1YWdlID0geyJuYW1lIjoiUHl0aG9uIiwidmVyc2lvbiI6IjIuNyIsImhlbGxvIjpmdW5jdGlvbigpIHsgcmV0dXJuICJIZWxsbyBmcm9tICIgKyB0aGlzLm5hbWV9fTsKCi8vIENvbXBhcmUgaW5zdGFuY2UgYW5kIGxpdGVyYWwgb2JqZWN0IHZhbHVlcwpjb25zb2xlLmxvZyhsaXRlcmFsTGFuZ3VhZ2UubmFtZSk7CmNvbnNvbGUubG9nKGluc3RhbmNlTGFuZ3VhZ2UubmFtZSk7CmNvbnNvbGUubG9nKGxpdGVyYWxMYW5ndWFnZS52ZXJzaW9uKTsKY29uc29sZS5sb2coaW5zdGFuY2VMYW5ndWFnZS52ZXJzaW9uKTsKY29uc29sZS5sb2cobGl0ZXJhbExhbmd1YWdlLmhlbGxvKCkpOwpjb25zb2xlLmxvZyhpbnN0YW5jZUxhbmd1YWdlLmhlbGxvKCkpOwpjb25zb2xlLmxvZyh0eXBlb2YobGl0ZXJhbExhbmd1YWdlKSk7CmNvbnNvbGUubG9nKHR5cGVvZihpbnN0YW5jZUxhbmd1YWdlKSk7CmNvbnNvbGUubG9nKE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChsaXRlcmFsTGFuZ3VhZ2UpKTsK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RvciBmdW5jdGlvbnMgZmF2b3IgcmV1c2FiaWxpdHkKY29uc29sZS5sb2cobGl0ZXJhbExhbmd1YWdlLmJ5ZSgpKTsKY29uc29sZS5sb2coaW5zdGFuY2VMYW5ndWFnZS5ieWUoKSk7CgovLyBDcmVhdGUgYSBuZXcgTGFuZ3VhZ2UgaW5zdGFuY2UgCnZhciBvdGhlckluc3RhbmNlTGFuZ3VhZ2UgPSBuZXcgTGFuZ3VhZ2UoIlB5dGhvbiIsIjMuNyIpOwovLyBZb3UgZ2V0IGFjY2VzcyB0byBieWUgYmVjYXVzZSB0aGUgTGFuZ3VhZ2UgcHJvdG90eXBlIHdhcyBtb2RpZmllZApjb25zb2xlLmxvZyhvdGhlckluc3RhbmNlTGFuZ3VhZ2UuYnllKCkpOwoKLy8gQ3JlYXRlIGEgbmV3IGxpdGVyYWwgbGFuZ3VhZ2UKdmFyIG90aGVyTGl0ZXJhbExhbmd1YWdlID0geyJuYW1lIjoiUHl0aG9uIiwidmVyc2lvbiI6IjIuNyIsImhlbGxvIjpmdW5jdGlvbigpIHsgcmV0dXJuICJIZWxsbyBmcm9tICIgKyB0aGlzLm5hbWV9fTsgCi8vIFlvdSB3b24ndCBnZXQgYWNjZXNzIHRvIGJ5ZSBzaW5jZSB5b3UgbmVlZCB0byBleHBsaWNpdGx5IGRlZmluZSBpdCBpbiBhIGxpdGVyYWwKLy9jb25zb2xlLmxvZyhvdGhlckxpdGVyYWxMYW5ndWFnZS5ieWUoKSk7IC8vIEVSUk9SIGJ5ZSBpcyBub3QgYSBmdW5jdGlvbgo="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
var Language = function(name,version) { 
 this.name = name;
 this.version = version;
 this.hello = function() { 
   return "Hello from " + this.name;
 }
};

var instanceLanguage = new Language("Python","2.7");


var literalLanguage = {"name":"Python","version":"2.7","hello":function() { return "Hello from " + this.name}};

// Compare instance and literal object values
console.log(literalLanguage.name);
console.log(instanceLanguage.name);
console.log(literalLanguage.version);
console.log(instanceLanguage.version);
console.log(literalLanguage.hello());
console.log(instanceLanguage.hello());
console.log(typeof(literalLanguage));
console.log(typeof(instanceLanguage));
console.log(Object.prototype.toString.call(literalLanguage));
console.log(Object.prototype.toString.call(instanceLanguage));


// However, even though the objects are identical in content, they're actually different 
if (literalLanguage == instanceLanguage) { 
  console.log("literalLanguage == instanceLanguage");
} else { 
   console.log("literalLanguage != instanceLanguage");
}

if (literalLanguage === instanceLanguage) { 
  console.log("literalLanguage === instanceLanguage");
} else { 
  console.log("literalLanguage !== instanceLanguage");
}

// In fact, not even two literal (or constructor) objects are ever equal
if ({} == {}) { 
  console.log("{} == {}");
} else { 
  console.log("{} != {}");
}

if ({} === {}) { 
  console.log("{} === {}");
} else { 
  console.log("{} !== {}");
}

// The Object.toString() compares the actual contents of an object 
if (literalLanguage.toString() == instanceLanguage.toString()) { 
  console.log("literalLanguage.toString() == instanceLanguage.toString()");
} else { 
   console.log("literalLanguage.toString() != instanceLanguage.toString()");
}

if (literalLanguage.toString() === instanceLanguage.toString()) { 
  console.log("literalLanguage.toString() === instanceLanguage.toString()");
} else { 
  console.log("literalLanguage.toString() !== instanceLanguage.toString()");
}


// With a constructor function, you get prototype inheritance
Language.prototype.bye = function()  { 
   return "Bye from " + this.name  + " " + this.version;
 };
 
// Literal objects can only append properties directly 
 literalLanguage.bye = function()  { 
   return "Bye from " + this.name + " " + this.version;
 };
 
// Same results, but constructor functions favor reusability
console.log(literalLanguage.bye());
console.log(instanceLanguage.bye());

// Create a new Language instance 
var otherInstanceLanguage = new Language("Python","3.7");
// You get access to bye because the Language prototype was modified
console.log(otherInstanceLanguage.bye());

// Create a new literal language
var otherLiteralLanguage = {"name":"Python","version":"2.7","hello":function() { return "Hello from " + this.name}}; 
// You won't get access to bye since you need to explicitly define it in a literal
//console.log(otherLiteralLanguage.bye()); // ERROR bye is not a function
Native Browser JavaScript