






















2014-07-06 23:23 小郝(Kaibo Hao) 阅读(367) 评论() 收藏 举报
In Java you could do something like:
Person adam = new Person();
In JavaScript you would do:
JavaScript’s constructor invocation looks as if
Person were a class, but it’s important to keep in mind that Person is still just a function.
Principle
When it comes to adopting an inheritance pattern for your project, you have quite a few options. You should always strive for picking a modern pattern, unless the team is really uncomfortable if there are no classes involved.
References:
JavaScript Patterns - by Stoyan Stefanov (O`Reilly)
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。