Skip to content

js面向对象探究 | hpoenixf's blog #14

Description

@hpoenixf

http://hpoenixf.com/posts/37425/

面向对象有三个特点,一个个来说 封装私有变量利用闭包实现对象的私有变量。 12345678910function Animal (age) { this.getAge = function () { return age }}var dog = new Animal(3)console.log(dog.age) // undefinedconsol

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions