File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed
docs/1-trial-session/09-functions Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ <!doctype html>
2+ < html lang ="ja ">
3+ < head >
4+ < meta charset ="utf-8 " />
5+ < title > 2つの積 解答例</ title >
6+ </ head >
7+ < body >
8+ < script src ="./script.js "> </ script >
9+ </ body >
10+ </ html >
Original file line number Diff line number Diff line change 1+ function multiply ( a , b ) {
2+ const result = a * b ;
3+ return result ;
4+ }
5+
6+ document . write ( multiply ( 3 , 4 ) ) ;
Original file line number Diff line number Diff line change @@ -83,6 +83,25 @@ function tryToDrive() {
8383
8484:::
8585
86+ ### 確認課題
87+
88+ 引数を 2 つとり、その積を<Term type =" javascriptReturnValue " >戻り値</Term >として<Term type =" javascriptReturn " >返す</Term ><Term type =" javascriptFunction " >関数</Term > ` multiply ` を定義してください。
89+
90+ <Answer type =" 2つの積 " >
91+
92+ ``` javascript
93+ function multiply (a , b ) {
94+ const result = a * b;
95+ return result;
96+ }
97+
98+ document .write (multiply (3 , 4 ));
99+ ```
100+
101+ <ViewSource url ={import.meta.url} path =" _samples/multiply " />
102+
103+ </Answer >
104+
86105## <Term type =" javascriptVariable " >変数</Term >の<Term type =" javascriptScope " >スコープ</Term >
87106
88107<p ><Term type =" javascriptFunction " >関数</Term >内で<Term type =" javascriptDeclaration " >宣言</Term >された<Term type =" javascriptVariable " >変数</Term >は、<Term type =" javascriptFunction " >関数</Term >内でのみ有効です。<Term type =" javascriptVariable " >変数</Term >が有効な範囲のことを、その<Term type =" javascriptVariable " >変数</Term >の<Term type =" javascriptScope " strong >スコープ</Term >と呼んでいます。</p >
You can’t perform that action at this time.
0 commit comments