LEARNING JAVASCRIPT - Trang 25

CHAPTER 1

Your First Application

Often, the best way to learn is to do: so we’re going to start off by creating a simple

application. The point of this chapter is not to explain everything that’s going on:

there’s a lot that’s going to be unfamiliar and confusing, and my advice to you is to

relax and not get caught up in trying to understand everything right now. The point

of this chapter is to get you excited. Just enjoy the ride; by the time you finish this

book, everything in this chapter will make perfect sense to you.

If you don’t have much programming experience, one of the things

that is going to cause you a lot of frustration at first is how literal

computers are. Our human minds can deal with confusing input

very easily, but computers are terrible at this. If I make a grammati‐

cal error, it may change your opinion about my writing ability, but

you will probably still understand me. JavaScript—like all pro‐

gramming languages—has no such facility to deal with confusing

input. Capitalization, spelling, and the order of words and punctu‐

ation are crucial. If you’re experiencing problems, make sure you’ve

copied everything correctly: you haven’t substituted semicolons for

colons or commas for periods, you haven’t mixed single quotation

and double quotation marks, and you’ve capitalized all of your

code correctly. Once you’ve had some experience, you’ll learn

where you can “do things your way,” and where you have to be per‐

fectly literal, but for now, you will experience less frustration by

entering the examples exactly as they’re written.

Historically, programming books have started out with an example called “Hello,

World” that simply prints the phrase “hello world” to your terminal. It may interest

you to know that this tradition was started in 1972 by Brian Kernighan, a computer

scientist working at Bell Labs. It was first seen in print in 1978 in The C Programming

1

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.