testingcase08.js
来自「《脚本驱动的应用软件开发方法与实践》源代码下载」· JavaScript 代码 · 共 51 行
JS
51 行
//*****************************************************************************
// A Practical Guide to Script-Driven Software Development
// Author: Qiming Lu Date: 5/1/2006
//*****************************************************************************
// Testing Case 8: automatic type conversion
Debugger.addBlankLine(1);
Debugger.trace("Testing Case 8", "automatic type conversion");
// Test some built-in objects
var currentDate = new Date();
Debugger.trace("Info", currentDate);
// Test a user-defined JS object
function Color(r, g, b)
{
this.r = r;
this.g = g;
this.b = b;
}
Color.prototype.toString = function()
{
return "RGB(" + this.r + "," + this.g + "," + this.b + ")";
}
var myColor = new Color(128, 128, 128);
Debugger.trace("Info", myColor);
// Test our C++ created object
try
{
var wheel1 = Application.car.createWheel("KUMHO", "red");
Debugger.trace("Info", wheel1);
}
catch (e)
{
Debugger.trace("Exception", e.message);
}
// Test our enhanced wheel object
try
{
var wheel2 = Application.car.createEnhancedWheel("KUMHO", "red");
Debugger.trace("Info", wheel2);
}
catch (e)
{
Debugger.trace("Exception", e.message);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?