In firefox, make Javascript.new like Ruby.new
Object.prototype['new']=function(){
var params=[];
var argc=arguments.length;
for(var i=0;i<argc;i++){
params.push('arguments['+i+']');
}
var code='return new this('+params.join(',')+');';
return new Function(code).apply(this,arguments);
}
Number.new(100);//100
String.new("text");//"text"
Array.new(1,2,3);//[1,2,3]
function Person(name){
this.name=name;
this.toString=function(){return this.name;}
}
tom=Person.new('Tom');
joy=Person.new('Joy');
tom+" and "+joy;
with
ExtJS,you can use it like this:
Ext.Window.new({height:100, width:200}).show();
分享到:
相关推荐
new.riders.press.ppk.on.javascript.sep.2006.rar
This book is for web developers and designers who work with React.js and JavaScript and who are new to unit testing and automation. It's assumed that you have a basic knowledge of JavaScript and HTML....
new.riders.press.ppk.on.javascript.sep.2006.chm
This book is both an example-driven programmer's guide and a keep-on-your-desk reference, with new chapters that explain everything you need to know to get the most out of JavaScript, including: ...
If you're new to JavaScript, it's a great place to start. New in this edition: Automating setup with the Grunt task runner Using CoffeeScript classes with the Backbone framework Using CoffeeScript'...
It also shows how object programming (OP) opens a new world of design possibilities that go far beyond inheritance. This book will help the intermediate JavaScript programmer learn to use both types...
However, the JavaScript landscape has changed dramatically in recent years, and you need to adapt to the new world of JavaScript that people now expect. Mastering modern JavaScript techniques and the...
This new edition has been extensively updated to reflect the way JavaScript is most commonly used today, introducing you to the latest tools and techniques available to JavaScript developers....
You should read through this course if you want to be able to take your JavaScript skills to a new level of sophistication. Style and approach This course is a comprehensive guide where each chapter...
Learn how to build an interactive source code analytics system using Roslyn and JavaScript. This concise 150 page book will help you create and use practical code analysis tools utilizing the new ...
This book is both an example-driven programmer's guide and a keep-on-your-desk reference, with new chapters that explain everything you need to know to get the most out of JavaScript, including: ...
better browsers, performance enhancements, and exciting new facilities. Combined with features such as Canvas, JavaScript offers web developers a truly viable alternative to plug-ins such as Adobe ...
Level-up: New JavaScript Tricks Chapter 2. The Canvas Drawing API Chapter 3. Working with Game Assets Chapter 4. Making Sprites and a Scene Graph Chapter 5. Making Things Move Chapter 6. ...
In complex web applications, the low-level details of your JavaScript code can obscure the workings of the system as a whole. As a coding style, functional programming (FP) promotes loosely coupled ...
the new features added in ES6 Find out about ECMAScript 6’s Arrow functions, and make them your own Understand objects in Google Chrome developer tools and how to use Them Use a mix of prototypal ...
JavaScript(和TypeScript)中完整的以太坊钱包实现和实用程序。 特征: 将您的私钥安全,可靠地保存在客户端中 导入和导出JSON钱包(Geth,奇偶校验和众筹) 导入和导出BIP 39个助记词短语(12个单词备用短语)和...
If you’re a programmer new to JavaScript, or even a beginner with little or no programming experience, this latest edition of practical book offers complete, no-nonsense coverage of this essential ...
This book will serve as an introduction to both new and well established libraries and frameworks, such as Angular, VueJS, React, Grunt, Yeoman, RequireJS, Browserify, Knockout, Kraken, Async.js, ...
Armed with a slew of new features, JavaScript now makes writing the code that powers your applications elegant, concise, and easy to understand. This book is a pragmatic guide to the new features ...
Don’t be frightened by the code: I know it might look intimidating at first, but once you’ve grasped the concepts behind the code, you’ll find yourself reading and writing in a new language....