javascript 面向对象OOP笔记
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>OOP</title> <script type="text/javascript"> function myOOP() { alert(this.a); alert(this.b); } var a = 12; window.b = 2; window.onload = function() { var c = [1,2,3,4,5,6]; var d = 7; c.e = 8; c.f = function () { alert(this.e); }; c.f(); this.myOOP(); window.myOOP(); myOOP(); }; </script> </head> <body> </body> </html>
工欲善其事 必先利其器