Preview:
// var p= new i('abhi')  ## CAN"T BE HOISTED
var i = function myName() {
    var n = 'name';
    this.getName = function() {
        return n;
    }
   
}

var Person = function(pName){
  var name = pName;

  this.getName = function(){
    return name;
  }
}

var p= new i('abhi')

console.log("Welcome to Programiz!", p.getName());

a();
function a() {
    console.log('a');
}

var a = function() {
    console.log('a');
}
var b = function bar() {
    console.log('b');
}

a();
bar();

##################

var t = (function() {
    let c=0;
    return function() { c+=1; return c; }
})();

console.log(c);
console.log(t());
console.log(t());
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