Every web page you open is made of three things. HTML is the words and the pictures. CSS is the colours. JavaScript is the part that moves. When you click a button and something happens, that is JavaScript. 你打开的每一个网页都由三样东西组成。HTML 是文字和图片。CSS 是颜色。 JavaScript 是会动的那一部分。你点一个按钮,然后有事情发生——那就是 JavaScript。 ทุกหน้าเว็บที่คุณเปิดทำจากสามอย่าง HTML คือคำและรูปภาพ CSS คือสี JavaScript คือส่วนที่ขยับได้ เมื่อคุณคลิกปุ่มแล้วมีอะไรเกิดขึ้น นั่นคือ JavaScript
You need nothing to start. No money. No new computer. Your browser can already run JavaScript. Work in this order: learn the words, drive the machines, then build a game and a map. 开始不需要任何东西。不用花钱,不用换电脑。你的浏览器已经能运行 JavaScript 了。 按这个顺序学:先学词,再驾驶机器,然后做一个游戏和一张地图。 เริ่มต้นไม่ต้องใช้อะไรเลย ไม่ต้องใช้เงิน ไม่ต้องซื้อคอมใหม่ เบราว์เซอร์ของคุณรัน JavaScript ได้อยู่แล้ว เรียนตามลำดับนี้: เรียนคำศัพท์ ขับเครื่องมือ แล้วสร้างเกมกับแผนที่
👾 Tutorial 1 — make a space game. Nine steps. You start with an empty file and finish with a game you can play with the arrow keys.Twenty-two words. Every word here is a real word from real code. Programmers all over the world say these words in English, so learning them is learning the job. Tap say it to hear one. Tap tell me more for the long answer.
二十二个词。这里每个词都来自真实代码。全世界的程序员都用英语说这些词,所以学会它们就是学会这份工作。点“say it”听发音,点“tell me more”看详细解释。
ยี่สิบสองคำ ทุกคำมาจากโค้ดจริง โปรแกรมเมอร์ทั่วโลกพูดคำเหล่านี้เป็นภาษาอังกฤษ เรียนคำพวกนี้คือเรียนงานจริง แตะ say it เพื่อฟัง แตะ tell me more เพื่ออ่านคำอธิบายยาว
Each machine shows real JavaScript on the left and the real result on the right. Move the slider, type a word, press a button. The code you see is the code that runs. 每台机器左边是真正的 JavaScript,右边是真正的运行结果。拖滑块、打字、按按钮。 你看到的代码就是正在运行的代码。 แต่ละเครื่องแสดงโค้ด JavaScript จริงทางซ้าย และผลลัพธ์จริงทางขวา เลื่อนแถบ พิมพ์คำ กดปุ่ม โค้ดที่คุณเห็นคือโค้ดที่กำลังทำงานอยู่
A variable is a box with a name. You put a value inside. Later you use the name, and the computer gets the value. The word let makes a new box. The equals sign puts something in it. Move the slider to change what is in the box.
变量就是一个有名字的盒子。你把一个值放进去。之后你用名字,电脑就取出那个值。let 造一个新盒子,等号把东西放进去。拖动滑块看盒子里的东西改变。
ตัวแปรคือกล่องที่มีชื่อ คุณใส่ค่าไว้ข้างใน ทีหลังคุณเรียกชื่อ คอมพิวเตอร์ก็หยิบค่านั้นมาให้ คำว่า let สร้างกล่องใหม่ เครื่องหมายเท่ากับใส่ของลงไป เลื่อนแถบเพื่อเปลี่ยนของในกล่อง
let means "make a new box". You only write
it the first time. After that you just use the name.
为什么用 let?let 的意思是“造一个新盒子”。只在第一次写它,之后直接用名字。
ทำไมต้อง let? let แปลว่า "สร้างกล่องใหม่" เขียนแค่ครั้งแรก หลังจากนั้นใช้แค่ชื่อYou now know nine ideas. That is enough to build real things. The space game uses all nine. The map uses seven of them, and adds real numbers from real places in Chiang Mai. Open one and follow the steps.
你已经学会九个概念,这足够做真东西了。太空游戏九个全用上;地图用了其中七个,还加上清迈真实地点的真实数字。打开一个,按步骤做。
ตอนนี้คุณรู้เก้าแนวคิดแล้ว พอสำหรับสร้างของจริง เกมอวกาศใช้ครบทั้งเก้า แผนที่ใช้เจ็ดอย่าง แล้วเพิ่มตัวเลขจริงจากสถานที่จริงในเชียงใหม่ เปิดอันไหนก็ได้แล้วทำตามขั้นตอน
Want the same two projects in Python? They are here: the Python space game and the Python map. Same ideas, different language — a very good way to see what is really a programming idea and what is only a word. 想用 Python 做同样两个项目?在这里:Python 太空游戏和 Python 地图。同样的思路,不同的语言——这是看清什么才是真正的编程概念、 什么只是写法的好办法。 อยากทำสองโปรเจกต์เดียวกันด้วย Python ไหม อยู่ที่นี่: เกมอวกาศ Python และ แผนที่ Python แนวคิดเดียวกัน คนละภาษา เป็นวิธีที่ดีมากในการเห็นว่าอะไรคือแนวคิดการเขียนโปรแกรมจริง ๆ และอะไรเป็นแค่คำ
let makes it. = puts
something in.
变量是有名字的盒子:let 造盒子,= 放东西进去。
ตัวแปรคือกล่องที่มีชื่อ let สร้าง = ใส่ของ5 is a number. "5" is a string.
引号造出文字:5 是数字,"5" 是字符串。
เครื่องหมายคำพูดทำให้เป็นคำ 5 คือตัวเลข "5" คือสตริงconsole.log messages.
浏览器里已经有全部工具:按 F12 打开控制台,看自己的 console.log。
เบราว์เซอร์มีเครื่องมือครบอยู่แล้ว กด F12 เปิดคอนโซลเพื่อดูข้อความ console.log ของคุณเองThank you for learning with us today. Go and break something, then fix it. See you in the next lab. 感谢今天和我们一起学习。去弄坏点东西,然后把它修好。下个实验室见。 ขอบคุณที่เรียนกับเราวันนี้ ไปทำอะไรพังแล้วซ่อมมันซะ แล้วเจอกันในแล็บหน้า