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

feat(repl): コンソールの開き方とデバッグ #545

Merged
merged 22 commits into from Oct 23, 2018
Merged

feat(repl): コンソールの開き方とデバッグ #545

merged 22 commits into from Oct 23, 2018

Conversation

azu
Copy link
Collaborator

@azu azu commented Oct 22, 2018

コードの評価と結果の表示

目的: ブラウザでのコード評価方法、Console APIの使い方、構文エラーとデバッグについて学ぶ

  • ブラウザ
  • Firefox
  • 開発者
  • コンソール

ここではブラウザの評価方法と確認方法について扱う。
エラーが発生したときに何をするかを考える。

扱わないこと

  • Node.js
  • デバッグ方法
  • Node.jsのREPL
  • ブレークポイント

アウトライン

  • ブラウザの選択 => Firefox
  • ブラウザでの実行方法
  • index.htmlとindex.jsを作成しscriptとして読み込んで実行する
  • Console APIの使い方を学ぶ
    • 開発者ツールの開き方
    • コードの実行方法、REPL
  • (ウェブ版) ウェブ版ではこの方法はワンクリックでできるようになっている
  • Node.jsについては2章であつかいます
  • 構文エラー(SyntaxError)が出る場合について
    • 例) const 2015;
    • スタックトレースの簡単な読み方
    • 詳細はtry...catchの章
  • 構文エラーは人間向けのエラーではない問題
    • 例) cosnt a = 1;
    • エラーの行例の前後も見てみよう
    • Firefoxではコンソールにエラーの詳細へのリンクがでるぞ
  • 実行時エラー(ランタイムエラー)
    • 例): console.logs()
    • 構文としては正しいが実行時に問題があり例外発生するもの
    • TypeErrorなどSyntaxError以外のもの
    • 実行時エラーは単純なものから複雜なもの(値に依存するもの)がある
  • デバッグ
    • あわてずにエラーの原因を追っていく => デバッグ
    • エラー文を検索する or MDNのエラーで該当してないものがあるものをみる or コードをよく読む
    • SyntaxError => あなたの書き方がなにか間違っています
    • TypeError => コードの動かしやメソッドの呼び出し方が何かおかしいです。どこでおかしくなったのかをconsole APIで見よう
  • まとめ
    • コードの実行
    • ログの出し方
    • エラーの種類
    • デバッグ

fix #85

@bot-user
Copy link

bot-user commented Oct 22, 2018

Deploy preview for js-primer ready!

Built with commit f0c1319

https://deploy-preview-545--js-primer.netlify.com

@azu azu merged commit 5bf392d into master Oct 23, 2018
@azu azu deleted the repl branch October 25, 2018 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

read-eval-print: コンソールの開き方について
2 participants