Chapter 9

Adding in JavaScript


Understanding JavaScript basics and structure

Coding with variables, conditional statements, and functions

Learning about API basics and structure

Viewing an API request and response

The best teacher is very interactive.


JavaScript, one of the most popular and versatile programming languages on the Internet, adds interactivity to websites. You have probably seen JavaScript in action and not even realized it, perhaps while clicking buttons that change color, viewing image galleries with thumbnail previews, or analyzing charts that display customized data based on your input. These website features and more can be created and customized using JavaScript.

JavaScript is an extremely powerful programming language, and this entire book could have been devoted to the topic. In this chapter, you learn JavaScript basics, including how to write JavaScript code to perform basic tasks, access data using an API, and program faster using a framework.

What Does JavaScript Do?

JavaScript creates and modifies web page elements, and works with the existing web page HTML and CSS to achieve these effects. When you visit a web page with JavaScript, your browser downloads the JavaScript code and runs it client-side, on your machine. JavaScript can perform tasks to do any of the following:

  • Control web page appearance and layout by changing HTML attributes and CSS styles.
  • Easily create web page elements like date pickers, as shown in Figure ...

Get Coding For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.