Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

誤字について #878

Open
aMitsukiAoyama opened this issue Jul 17, 2024 · 1 comment
Open

誤字について #878

aMitsukiAoyama opened this issue Jul 17, 2024 · 1 comment
Labels
stage2:着手可 着手できるフェーズのissueです。プルリクエストを作成できます。

Comments

@aMitsukiAoyama
Copy link

https://github.com/yytypescript/book/edit/master/docs/reference/functions/callback-functions.md

このページの部分での小さなミスをを見つけたので報告させていただきます。

function greetNewUser(func: (name: string) => string) {
  console.log(func("ご新規さん"));
}
 
function hello(name: string) {
  return `こんにちは!${name}さん!!`;
}
 
function goodMorning(name: string) {
  return `おはようございます!${name}さん!!`;
}
 
// こんにちは!ご新規さん!!
greetNewUser(hello);
 
// おはようございます!ご新規さん!!
greetNewUser(goodMorning);

このコードなのですが出力は「こんにちは!ご新規さんさん!!」と「おはようございます!ご新規さんさん!!」になるのではないでしょうか?
console.log(func("ご新規さん"));の部分を console.log(func("ご新規"));に変更するか、
return `こんにちは!${name}さん!!`;の部分をreturn `こんにちは!${name}!!`;
return `おはようございます!${name}さん!!`;の部分をreturn `おはようございます!${name}!!`;にするのが適切ではないかと思います。

@suin suin added the stage2:着手可 着手できるフェーズのissueです。プルリクエストを作成できます。 label Aug 16, 2024
@suin
Copy link
Contributor

suin commented Aug 16, 2024

ご報告ありがとうございます!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage2:着手可 着手できるフェーズのissueです。プルリクエストを作成できます。
Projects
None yet
Development

No branches or pull requests

2 participants