function f1() {} var f2 = angular.extend(f1, { active: false, toggle: function() { this.active = !this.active } }) console.log(f1, f1.active) console.log(f2, f2.active) f1.toggle() console.log(f1, f1.active) console.log(f2, f2.active) var o1 = { a: ‘a‘ } var o2 = angular.extend(o1, { b: ‘b‘ }) console.log(o1, o2)
时间: 2024-10-23 09:53:23