หน้าแรก

Javascript

JavaScript คือ ภาษาคอมพิวเตอร์สำหรับการเขียนโปรแกรมบนระบบอินเทอร์เน็ต ที่กำลังได้รับความนิยมอย่างสูง Java JavaScript เป็น ภาษาสคริปต์เชิงวัตถุ (ที่เรียกกันว่า "สคริปต์" (script) ซึ่งในการสร้างและพัฒนาเว็บไซต์ (ใช่ร่วมกับ HTML) เพื่อให้เว็บไซต์ของเราดูมีการเคลื่อนไหว สามารถตอบสนองผู้ใช้งานได้มากขึ้น ซึ่งมีวิธีการทำงานในลักษณะ "แปลความและดำเนินงานไปทีละคำสั่ง" (interpret) หรือเรียกว่า อ็อบเจ็กโอเรียลเต็ด (Object Oriented Programming) ที่มีเป้าหมายในการ ออกแบบและพัฒนาโปรแกรมในระบบอินเทอร์เน็ต สำหรับผู้เขียนด้วยภาษา HTML สามารถทำงานข้ามแพลตฟอร์มได้ โดยทำงานร่วมกับ ภาษา HTML และภาษา Java ได้ทั้งทางฝั่งไคลเอนต์ (Client) และ ทางฝั่งเซิร์ฟเวอร์ (Server)

วิธีการเขียน Hello World

      
        console.log("Hello World")
        // Hello World
    

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Illum, quis distinctio. Consequuntur neque quod asperiores. Aliquam debitis labore nobis laborum.

วิธีการคำนวนทางคณิตศาสตร์

      
        console.log(1 + 1)
        // 2
    

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Illum, quis distinctio. Consequuntur neque quod asperiores. Aliquam debitis labore nobis laborum.

วิธีการใช้ตัวแปร

      
        const name = "John Doe"
        let age = 24
        console.log(name + ", I'm " + age + "years old")
        // John Doe, I'm 24 years old
    

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Illum, quis distinctio. Consequuntur neque quod asperiores. Aliquam debitis labore nobis laborum.

แบบฝึกหัด

ให้นักเรียนเขียนโปรแกรมแสดงชื่อ นามสกุล และอายุ ในอีก 10 ปีข้างหน้า โดยใช้ความรู้ที่เรียนไป ตามตัวอย่างด้านล่างง

      
       John Doe
       I'll be 25 years old in 2029
    

ลองเขียน Javascript