ページへ戻る
− Links
印刷
TypeScriptの関数
の編集 ::
NJF Wiki
xpwiki
:
TypeScriptの関数
の編集
# cf68938f の編集
ページ内容:
*オプション引数とデフォルト引数 [#cf68938f] 関数の引数に「?」をつけると引数を省略できるオプション引数にできる。 function testFunc(x:number,y?:number){ if(y){ return x + y; } return x; } console.log(testFunc(1)); // => 1 console.log(testFunc(1,2)); // => 3 引数に「=」をつけるとデフォルト引数が指定できる。 function testFunc(x:number,y:number = 10){ return x + y; } console.log(testFunc(1)); // => 11 console.log(testFunc(1,2)); // => 3
編集の要約:
Q & A 認証:
ページ更新時は次の質問にお答えください。(プレビュー時は必要ありません)
Q:
「大阪」の読みがな?(ひらがなで)
A:
お名前:
タイムスタンプを変更しない
テキスト整形のルールを表示する
[1]
Links list
(This host) = https://njf.jp
(This host)
/cms/modules/xpwiki/?cmd=edit&help=true&page=TypeScript%E3%81%AE%E9%96%A2%E6%95%B0