首页 > 代码库 > js_5_面向对象

js_5_面向对象

什么是js面向对象?

      function Foo(name,age){

              this.Name = name;

         this,Age = age;

         this.Fun = function(arg){

        return this.Name+arg;

      }

    }

  var obj = new Foo(‘yizhihua’,’18’);

  console.log(obj.Name);

  console.log(obj.Age);

  var res = obj.Foo(‘mei’)

  console.log(res)

js_5_面向对象