LEARNING JAVASCRIPT - Trang 26

1

I hope you have more compassion for your creations than Dr. Frankenstein—and fare better.

Language, by Brian Kernighan and Dennis Ritchie. To this day, The C Programming

Language is widely considered to be one of the best and most influential program‐

ming language books ever written, and I have taken much inspiration from that work

in writing this book.
While “Hello, World” may seem dated to an increasingly sophisticated generation of

programming students, the implicit meaning behind that simple phrase is as potent

today as it was in 1978: they are the first words uttered by something that you have

breathed life into. It is proof that you are Prometheus, stealing fire from the gods; a

rabbi scratching the true name of God into a clay golem; Doctor Frankenstein breath‐

ing life into his creation.

1

It is this sense of creation, of genesis, that first drew me to

programming. Perhaps one day, some programmer—maybe you—will give life to the

first artificially sentient being. And perhaps its first words will be “hello world.”
In this chapter, we will balance the tradition that Brian Kernighan started 44 years

ago with the sophistication available to programmers today. We will see “hello world”

on our screen, but it will be a far cry from the blocky words etched in glowing phos‐

phor you would have enjoyed in 1972.

Where to Start

In this book, we will cover the use of JavaScript in all its current incarnations (server-

side, scripting, desktop, browser-based, and more), but for historical and practical

reasons, we’re going to start with a browser-based program.
One of the reasons we’re starting with a browser-based example is that it gives us easy

access to graphics libraries. Humans are inherently visual creatures, and being able to

relate programming concepts to visual elements is a powerful learning tool. We will

spend a lot of time in this book staring at lines of text, but let’s start out with some‐

thing a little more visually interesting. I’ve also chosen this example because it organi‐

cally introduces some very important concepts, such as event-driven programming,

which will give you a leg up on later chapters.

The Tools

Just as a carpenter would have trouble building a desk without a saw, we can’t write

software without some tools. Fortunately, the tools we need in this chapter are mini‐

mal: a browser and a text editor.
I am happy to report that, as I write this, there is not one browser on the market that

is not suited to the task at hand. Even Internet Explorer—which has long been a

2 | Chapter 1: Your First Application

Liên Kết Chia Sẽ

** Đây là liên kết chia sẻ bới cộng đồng người dùng, chúng tôi không chịu trách nhiệm gì về nội dung của các thông tin này. Nếu có liên kết nào không phù hợp xin hãy báo cho admin.