JSFiddle - React, Tailwind, and code Playground

by bogdan_vq

HTML

a.ib

JavaScript

function Complex(r, i) {
    //private
    var real = r;
    var imag = i;
    
    //public
    this.getComplex = function() {
        return real + ".i" + imag;
    }
}


var c1 = new Complex(1, 1);

console.log(c1.getComplex());
console.log(c1.real);


var c2 = new Complex(11, 2);
//console.log(c2.getComplex());