Why is STACK capitalized in var

var Stack = function() {
this.count = 2;
this.storage = {1, 2};

I was going over JavaScript Data Stru… and I saw a capitlized variable. Why is that… what is that???

I know we capitalize classes and construction functions, but I have never seen it in a variable.

in javascript, functions are also objects. You can declear a function that can be used like a class instead of using the class decorator.

Oh I think I get it!!! You are saying that the variable object is used like a class?

This…

class MyObject {
        constructor(n){
               this.n = n
        }
        myMethod(){
               return this.n
        }
}

is the same as …

var myObject = function(n){
	this.n = n
	var myMethod = function(){
		return this.n
	}
}

thank your for that…i was confused… so many ways to do things.