"use strict";
function square(x) {
return x * x;
}
function add(square,y) {
return square(4) +y
document.write(square + y)
}
add(4,1);
console.log(add(4,1));
別の関数のパラメータと同じ関数を使用する必要があります。関数を別の関数のパラメータとして使用する
add(square,1);
をあなたにもあることを
function add(square,y) {
return square(4) +y
document.write(square + y)
}
を変更することもできます::
function add(square,y) {
document.write(square(4) + y)
return square(4) +y
}
パー私はちょうどそのように呼んで出力する17
を行う可能性があります呼び出します'*は非常に落胆しています*。 – Li357
本当に、@ AndrewL.isがなぜそれを言っているのかについては、[もっと読む](http://stackoverflow.com/questions/802854/why-is-document-write-considered-a-bad-practice)することができます。 – httpNick
ありがとうAndrew私はこのコンセプトが非常に混乱していると感じています。実際にこれを教えるチュートリアルをお勧めできますか? –