Skip to Content
Head First JavaScriptプログラミング、第2版
book

Head First JavaScriptプログラミング、第2版

by Eric Freeman, Elisabeth Robson
March 2025
Intermediate to advanced
662 pages
13h 28m
Japanese
O'Reilly Media, Inc.
Content preview from Head First JavaScriptプログラミング、第2版

第1章. JavaScriptの世界に飛び込もう:足を濡らす

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

Image

JavaScriptはあなたにスーパーパワーを与える。Webの真のプログラミング言語であるJavaScriptを使えば、Webページに振る舞いを加えることができる。JavaScriptを使えば、ユーザと触れ合ったり、面白いイベントにReactしたり、Webページからデータを取得してWebページで使ったり、グラフィックをWebページに直接描き込んだり、他にもいろいろできる。JavaScriptを知れば、ユーザのために全く新しい振る舞いを作成することもできるようになる。

あなたは良い仲間にも恵まれるだろう。JavaScriptは最も人気のあるプログラミング言語のひとつであるだけでなく、すべてのモダンブラウザでサポートされており、ブラウザ以外の多くの環境でも使われている。それについては後で詳しく説明する!

JavaScriptの仕組み

Webページの構造、コンテンツ、レイアウト、スタイルの作成に慣れているなら、そろそろ振る舞いも追加してもいい時期ではないだろうか?結局のところ、ページがただそこに座っている必要はないのだ。優れたページはインタラクティブで ダイナミックであるべきだ。そこでJavaScriptの出番だ。まずは、JavaScriptがWebページのエコシステムにどのように組み込まれているかを見てみよう:

Image

JavaScriptをどう書くのか?

JavaScriptはウェブブラウザ用のプログラミング言語だ。一般的なプログラミング言語では、コードを書き、コンパイルし、リンクし、デプロイしなければならない。JavaScriptの場合、必要なのはページにコードを書き、それをブラウザに読み込ませるだけだ。ブラウザはそこから喜んであなたのコードを実行し始める。この仕組みを詳しく見てみよう:

Image
  • Image 執筆

    いつものようにHTMLコンテンツとCSSスタイルでページを作成する。そして、JavaScriptもページに含める。見てわかるように、HTMLやCSSと同じように、すべてを1つのファイルにまとめることもできるし、JavaScriptを独自のファイルに入れてページに含めることもできる。

    最良の方法については、もう少し後で話そう。

  • ローディング

    いつものように、ブラウザをあなたのページに向ける。ブラウザはコードを見てすぐに解析を始め、実行の準備をする。HTMLやCSSと同じように、もしブラウザがあなたのコードにエラーを見つけたら、ブラウザは最善を尽くして動き続け、さらにJavaScript、HTML、CSSを読み取り続ける。ブラウザが一番避けたいことは、ユーザにページを見せることができないことだ。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

技術リーダーシップのための14のヒント

技術リーダーシップのための14のヒント

島田 浩二
カオスエンジニアリング ―回復力のあるシステムの実践

カオスエンジニアリング ―回復力のあるシステムの実践

Casey Rosenthal, Nora Jones, 堀 明子, 松浦 隼人
Tidy First? ―個人で実践する経験主義的ソフトウェア設計

Tidy First? ―個人で実践する経験主義的ソフトウェア設計

Kent Beck, 吉羽 龍太郎, 永瀬 美穂, 細澤 あゆみ

Publisher Resources

ISBN: 9798341633186