- Store useful values inside variables. In the above example, for instance, we ask for a new name to be entered then store that name in a variable called
- Operations on pieces of text (known as “strings” in programming). In the above example, we take the string “Player 1: ” and join it to the
namevariable to create the complete text label, e.g. ”Player 1: Chris”.
- Running code in response to certain events occurring on a web page. We used a
clickthe event in our example above to detect when the button is clicked and then run the code that updates the text label.
APIs are ready-made sets of code building blocks that allow a developer to implement programs. That would otherwise be hard or impossible to implement. They do the same thing for programming that ready-made furniture kits do for home building. So, it is much easier to take ready-cut panels. Screw them together to make a bookshelf than it is to work out the design yourself. Go and find the correct wood, cut all the panels to the right size and shape. Find the correct-sized screws, and then put them together to make a bookshelf.
The Future Of This Language