loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.33528673238067497","path":"main.js","file":{"path":"main.js","content":{"asEncoding":{"base64":"dmFyIExldHRlciA9IGZ1bmN0aW9uKHZhbHVlKSAgewogIHRoaXMudmFsdWUgPSB2YWx1ZTsKICB0aGlzLmlhbSA9IGZ1bmN0aW9uKCkgeyAKICAgcmV0dXJuIGBJIGFtIHRoZSAke3RoaXMuY29uc3RydWN0b3IubmFtZX0gJHt0aGlzLnZhbHVlfWA7CiAgfTsKICB0aGlzLmFscGhhYmV0ID0gZnVuY3Rpb24oKSB7IAogICByZXR1cm4gdGhpcy52YWx1ZSArICIgaXMgbGV0dGVyIE5vLiIgKyAnMGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6Jy5pbmRleE9mKHRoaXMudmFsdWUpICsgIiBpbiB0aGUgYWxwaGFiZXQiOwogIH07Cn07Cgp2YXIgdGVzdCA9IG5ldyBMZXR0ZXIoImEiKTsKY29uc29sZS5sb2codGVzdC5pYW0oKSk7CmNvbnNvbGUubG9nKHRlc3QuYWxwaGFiZXQoKSk7CgoKdmFyIFZvd2VsID0gZnVuY3Rpb24odmFsdWUpIHsgCiAgaWYgKFsiYSIsImUiLCJpIiwibyIsInUiXS5pbmRleE9mKHZhbHVlKSA9PT0gLTEpCiAgICAgICAgdGhyb3cgbmV3IFN5bnRheEVycm9yKCJJbnZhbGlkIHZvd2VsIik7CiAgLy8gQ2FsbCBwYXJlbnQgY29uc3RydWN0b3IuCiAgTGV0dGVyLmNhbGwodGhpcyx2YWx1ZSk7Cn07CgovLyBBc3NpZ24gY2hpbGQgcHJvdG90eXBlIHNhbWUgcHJvdG90eXBlIGFzIHBhcmVudCAKVm93ZWwucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShMZXR0ZXIucHJvdG90eXBlKTsKLy8gUmVhc3NpZ24gY29ycmVjdCBjb25zdHJ1Y3RvciB0byBjaGlsZApWb3dlbC5wcm90b3R5cGUuY29uc3RydWN0b3IgPSBWb3dlbDsKCgp2YXIgdGVzdDIgPSBuZXcgVm93ZWwoImkiKTsKY29uc29sZS5sb2codGVzdDIuaWFtKCkpOwpjb25zb2xlLmxvZyh0ZXN0Mi5hbHBoYWJldCgpKTsK"},"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
var Letter = function(value)  {
  this.value = value;
  this.iam = function() { 
   return `I am the ${this.constructor.name} ${this.value}`;
  };
  this.alphabet = function() { 
   return this.value + " is letter No." + '0abcdefghijklmnopqrstuvwxyz'.indexOf(this.value) + " in the alphabet";
  };
};

var test = new Letter("a");
console.log(test.iam());
console.log(test.alphabet());


var Vowel = function(value) { 
  if (["a","e","i","o","u"].indexOf(value) === -1)
        throw new SyntaxError("Invalid vowel");
  // Call parent constructor.
  Letter.call(this,value);
};

// Assign child prototype same prototype as parent 
Vowel.prototype = Object.create(Letter.prototype);
// Reassign correct constructor to child
Vowel.prototype.constructor = Vowel;


var test2 = new Vowel("i");
console.log(test2.iam());
console.log(test2.alphabet());
Native Browser JavaScript