Preview:
function myFunction(arg1, arg2) {
  const firstName = arg1;
  this.lastName  = arg2;
  this.cusfun = function (wow) {
  	console.log('---->', this.firstName, wow);
    return firstName;
  }
}

const myObj = new myFunction("John","Doe");
console.log(myObj.cusfun('hi'));
console.log('--------');
console.log(myObj.lastName);
console.log(myFunction.lastName);
console.log(myObj.firstName);
console.log(myFunction.firstName);
console.log('--------');
console.log(typeof myFunction);
console.log(typeof myObj);
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter