JSFiddle - React, Tailwind, and code Playground

JavaScript

var Person = function(name){

    //public
    this.name = name;
    
    //private
    var private = 'private';

    //privileged with access to public and private instance vars
    this.abunny = function(){
        alert('Look, '+ this.name + ' a bunny!');
        alert('…and a '+ private + ' variable.');
    }
    
    //private function
    function privateFunction(){
        return 'good luck';
    }    
    
};

//create new instance of Person
var Amir = new Person('Amir');

//test access to instance vars
alert(Amir.name); //Amir
alert(Amir.private); //undefined

//test access to functions
Amir.abunny(); //Look, Amir a bunny! ..and a private variable.
Amir.privateFunction; //nothing happens, good luck with that... 
Amir.privateFunction(); //TypeError: 'undefined is not a function'