JSFiddle - React, Tailwind, and code Playground

by Sri Vaishnavi

HTML

<h3> Classes Javascript </h3>

JavaScript

var Attribute = function(name, id, value) {
	this.name = name;
	this.id = id; 
	this.value = value;
};



var attribute = new Attribute("Subject","subject1","true");

alert(attribute.toString());
alert(JSON.stringify(attribute));

/*var Foo = function (name) { this.name = name; };
Foo.prototype.data = [1, 2, 3]; // setting a non-primitive property
Foo.prototype.showData = function () { alert(this.name+" - "+ this.data); };

var foo1 = new Foo("foo1");
var foo2 = new Foo("foo2");

// both instances use the same default value of data
foo1.showData(); // "foo1", [1, 2, 3]
foo2.showData(); // "foo2", [1, 2, 3]

// however, if we change the data from one instance
foo1.data.push(4);

// it mirrors on the second instance
foo1.showData(); // "foo1", [1, 2, 3, 4] -*/