16 Jan 2023

What Is Javascript, What Does It Do, And Should I Use It?

Coding
Building web pages is an exciting way to develop coding skills, but with so many terms to learn it can be overwhelming to start out.

 

Gif of a cartoon cat playing with a computer
giphy
Javascript (sometimes abbreviated to JS) is a programming language, used in front-end development. This means the code executes on your personal computer (client-side code) and not a far-away server. You can learn more about the differences between frontend and backend development here >> 
 
JS, along with HTML and CSS provides the code for the parts of the website that the user sees and interacts with. To get specific, HTML gives the page structure, whilst CSS makes it look pretty, and JS makes it interactive.
 
Want to learn more about HTML and how it fits in with CSS and Javascript? Check out this article>> 

 

The cake analogy

You can think about the HTML, CSS and JS trio as being layers of a cake. HTML is the basic sponge; you can have a web page using only HTML but it would be very boring, and ugly, like a plain sponge. CSS is the icing: it makes the cake look pretty, but doesn’t add much substance to it. Finally, JS is the filling, it gives the webpage that wow factor. You can add both the CSS and JS into the HTML sponge, or you can write them in separate files, making the code a bit tidier. Both methods work well, and both have their advantages.
 
Without Javascript, websites are ‘static’. This means that beyond showing the page, your website won’t do much without Javascript. This includes even simple interactivity, such as a page changing when you click a button.
 
Here’s an overview of what you can do in Javascript:
 
  • Store useful information in variables. For example, you might store a password entered by the user into a variable for a while, before checking if it’s correct.
 
  • Perform operations on numbers and strings.
 
  • Carry out code when an ‘event’ occurs, for example when somebody clicks a button.
 
  • Define functions. Like in other programming languages such as Python, you can define a block of code (a function), that is ‘called’ by several different events. This allows you to reuse the code that you wrote for the function.
 
Now that you know what Javascript does, learn how to use it in your web development projects using this tutorial>>
 
 Article written by Britt Dewing, Stemettes Intern

 

Coding
Did you enjoy this article? Click on a star to rate it!
Average rating 0 / 5
Next in this issue...
Upcoming Events
Parent, guardian, teacher or volunteer?

The Stemettes Zine is a curated space tailored specifically to Stemettes but we have plenty of content and updates for you folks too. Sign up to receive the Stemettes newsletter and we’ll keep you updated with the latest from Stemettes HQ including events, activities, resources and fundraising activities.