js原型链继承和闭包例子
<script type="text/javascript">Function.prototype.method = function(name,func){this.prototype = func;return this;}String.method('deentityify',function(){var entity={quot:'"',lt:'<',gt:'>'};return function(){return this.replace(/&([^&;]+);/g,function(a,b){var r = entity;return typeof r==='string'?r:a;});};}());document.writeln('&lt;&quot;&gt;'.deentityify());//<"></script>
页:
[1]