.
.
Now it's time to write a function that accepts some input.
今回は入力を受け入れる関数を書く時間です。
.
For inputs you might see the term parameter or argument. See details for a distinction between these two terms.
入力については、パラメータまたは引数という用語を見ることができます。これら2つの用語の違いについては詳細をご覧ください。
.
When calling a function with an input, we pass the input into the parenthesis:
関数に入力を渡して呼び出す場合、入力を括弧に渡します。例:
.
addOne(1);
.
When defining a function that takes an input, we will also add it to the parenthesis!Inside the function definition:
入力を受け取る関数を定義する場合は、括弧にも追加します!関数定義内部。例:
.
function addOne(input) {
const output = input + 1;
return output;
}
.
The
+is referred to as an addition operator. This operator takes two numbers and adds them together. For instance,3 + 1would evaluate to4.
+は加算演算子として知られています。この演算子は2つの数値を取り、それらを足し合わせます。例えば、3 + 1は4に評価されます。
.
On the flip side, JavaScript also has a subtraction operator
-. JavaScript has many more operators which we'll discuss in future stages!
一方、JavaScriptには減算演算子-もあります。JavaScriptには今後のステージで話すほかにもたくさんの演算子があります!
.
.
1.Complete the addTwo function to take an
inputand add2to it.
入力を受け取り、それに2を足した値を返すaddTwo関数を完成させましょう。
.
2.Return that sum.
その合計値を返します。
.
.

