JSFiddle - React, Tailwind, and code Playground

by Thomas Upton

JavaScript

var A = function(b) {
  this.b = b;
  this.c = 2;
}
A.prototype.d = function() {
  return this.c + this.b;
}
A.prototype.alterC = function(newVal) {
  this.c = newVal;
}
var a = new A(1);
console.log(a);
console.log('new a', a.d());

window.c = 5;

console.log('with window.c', a.d());

a.alterC(5);
console.log('altered c', a.c, 'a.d()', a.d());