JSFiddle - React, Tailwind, and code Playground

by seong gyun jeon

JavaScript

function User(/*string*/uid, /*string*/name) {

    this.uid = uid;
    this.name = name;

    this.constructor = this.constructor;
}

// this === new User()
console.debug(new User('mohwa', 'mohwaName').uid);
console.debug(new User('mohwa', 'mohwaName').name);
console.debug(new User('mohwa', 'mohwaName').constructor);
// this === window
console.debug(User('mohwa', 'mohwaName').uid);
console.debug(User('mohwa', 'mohwaName').name);
console.debug(User('mohwa', 'mohwaName').constructor);