Can you take a look at what this variable is called in object-oriented?

help to see if the following js oop code interprets private variables, instance variables, static variables, and public variables correctly.
by the way, what is variable a? What"s the name of a variable in oop?

var Oop = (function () {

  var a = "A"

  function Oop() {
    // private
    var _private = "private"

    // 
    this.name = "james"
  }

  vue.prototype = {
    constructor: Oop,
    consoleName: function () { // public
      console.log(this.name)
    }
  }

  Oop.staticFunc = function () { } // static

  return Oop
})()
The variable

a should not exist in programming languages such as java. 1 he is not in Oop, so it is not counted as a private variable or instance variable, nor is it called by the class, nor is it a static variable. What's more, it won't be called by the outside world
, but you can store the version information, the author, something that has nothing to do with logic, in a variable like a, and then in things like
return {Oop: Oop, version: a}


.
strictly speaking, there is no concept of private members in JavaScript; all object properties are public. However, there is a concept of private variables. Any variable defined in a function can be considered private because it cannot be accessed outside the function.

Private variables include function parameters, local variables, and other functions defined within the function.

  Link description  

Menu