次のコードが Safari/Javascript と Illustrator/ExtendScript で異なる結果を返す理由を誰か説明できますか?
私のテストでは、これのブラウザー バージョンは期待どおりに動作するようです。イラストレーターはあまり。これは本物のバグですか?それとも、ExtendScript (Creative Suite アプリ用の Adobe の Javascript 実装) と apply メソッドの問題ですか?
function testMinMax(){
var testArray = [2,1,7,3,6,7,8,23,45,26,13,9];
function getMinOfArray(numArray) {
return Math.min.apply(Math, numArray);
}
function getMaxOfArray(numArray) {
return Math.max.apply(Math, numArray);
}
alert ("min [" + getMinOfArray(testArray) + "] of " + testArray);
alert ("max [" + getMaxOfArray(testArray) + "] of " + testArray);
// Expected Values:
// min [1] of 2,1,7,3,6,7,8,23,45,26,13,9
// max [45] of 2,1,7,3,6,7,8,23,45,26,13,9
// Illustrator Scripting returns the following values
// min [1] of 2,1,7,3,6,7,8,23,45,26,13,9
// max [9] of 2,1,7,3,6,7,8,23,45,26,13,9
}
// Call the test case
testMinMax();