Last Updated on March 31, 2018 by WebsiteDesigner.sg

When learning about the world of computer language, there are three main “languages” to study. HTML is the raw data on a page or website. CSS is how that data is displayed. The last – JavaScript – is how the resulting page responds during user interaction. Read on for the basics of JavaScript.

Why and How

The “why” of JavaScript is simple – the Internet would be pretty boring if all we could do was read text or look at photos. How JavaScript saves us from this boredom is by allowing programmers to alter text and photos. For example, JavaScript can hide a portion of text or show it, allow interaction with a photo or stock image, or change HTML text into something else entirely.

JavaScript is known as a scripting language. Since it’s the most widely used scripting language, it is the default scripting language for all of HTML.

How You’ve Used JavaScript

JavaScript is more obvious to users than either HTML or CSS. For example, if you’ve ever looked at a web page which featured updated news, interactive maps or animation, you’ve benefited from JavaScript. Without JavaScript, that news feed wouldn’t be a feed at all – you would sit and stare at the same news stories until you manually clicked on a button or refreshed the page.

How JavaScript Interacts with HTML and CSS

These three – HTML, CSS and JavaScript, are generally known as the building blocks of web pages. JavaScript is perhaps the most fun, allowing programmers from a freelance web designer singapore to add all sorts of interactive and animated aspects to an otherwise plain web page.

JavaScript does this by taking a “string” of HTML and CSS code and adding onto it in a specific way. For example, HTML and CSS can create a button on a website which a user can click on. JavaScript tells the button what to do when a user clicks on it. This is an extremely simplified example, as the things which are possible through JavaScript are very complex and numerous. However, it lays the foundation for how JavaScript interacts with it’s fellow building blocks.

Application Programming Interfaces (APIs)

Separate from but based upon JavaScript, APIs are programs that allow your web experience to be smoother and more intelligent. These are platforms built upon JavaScript. There are two main categories of APIs: Third Party and Browser.

Third Party API’s represent something you can place on your website after retrieving them from the Internet. Placing an interactive Google Maps widget on your site is a great example of a third party API.

Browser API’s are built into browsers such as Chrome, Firefox and many others. Sticking with the Google Maps example, the Geolocation API is how Google Maps determines where you are and delivers directions or local maps without your having to manually type in your location each time you visit the site.

As you can see, JavaScript is the most interactive and fun of the major web building blocks. It allows programmers to create new and exciting pages and features, while allowing users to access new things in different ways.