JavaScript Quick Reference Guide

If you’re new to the world of web development, you’ve probably heard this term thrown around a lot. So, what exactly is Javascript? In simple terms, it’s a programming language that’s commonly used to make web pages interactive and dynamic.

When you hear developers talking about Javascript, you might also come across terms like “functions”, “variables”, “DOM manipulation”, “events”, and “AJAX”. These are all core concepts of Javascript that you’ll need to understand as you dive deeper into web development.

Whether you’re looking to build a simple website or a complex web application, having a good grasp of these Javascript fundamentals is essential.

So, if you’re ready to level up your web development skills, getting familiar with these core Javascript terms is a great place to start. Happy coding!

Vocabulary

The core terms you’ll hear when discussing JavaScript.

JavaScript | read more
JavaScript is a programming language that most of the web is built on. In the house analogy of web design, JavaScript is the brains of the page: it has “sensors” and routines to interact with user inputs and actions. It builds on HTML’s content and CSS’s style, but unlike CSS, JavaScript can perform most tasks independently of the front-end (what you see).
Variable | read more
var age = 10;
var name = “John”;
var canDrive = false;
A way for your computer to store little pieces of information. A variable has a name and a value.The name, when referenced, will return whatever it is equal to.Variables can be information of any data type.
Data Type | read more
var integer = 10;

These are the main types of information that can be used in scripting.Integers are numbers. They can have math performed on them, and make up the backbone of everything.
var string = “Hello World!”;Strings are text. JavaScript can’t use them for logic or math, but they are used for most output you see from your code.
var boolean = true;Booleans are a binary logical statement. true/false, 1/0, (something)/null are all boolean values.
Concatenation | read more
var greeting = “My name is ” + name + “. I am ” + age + ” years old.”;You can combine different strings, numbers, and variables the same as you would in math: by adding them together. In this case, we take the words in our message, then break from text to add our variable name dynamically into the sentence, then break back into text.
Operator | read more
var yearsUntilCanDrive = 16 – age;Plus, minus, multiply, divide, square, modulus, etc. Operators work exactly like math problems, and follow the PEMDAS order of operations when working with numbers.
Function | read more
function myFunction() {
    alert(‘Hello World!’);
}
A set of commands that can be run through all at once. Functions are one of the most powerful programming tools because you can write a set of commands that can be carried out over and over again. 
Conditions | read more
if(yearsUntilCanDrive < 0) {
    alert(‘You can drive!’);
    canDrive = true;
}
else {
    alert(‘Sorry, you will have to wait ‘ + yearsUntilCanDrive + ‘ years before you can drive!’);
}
A piece of code that checks if something is true or false, and only runs the code inside if the condition is met. Else it runs a different piece of code. 
This is also called an if-statement, or a logic gate.
Parameters | read more
multiply(5, 200);

function multiply(x, y) {
    alert(x * y);
    // ^ returns 1000
}
Parameters are variables that you can require to be passed into a function, allowing you to change the output based on your input.
Array | read more
var fruit = [‘apple’, ‘orange’, ‘kiwi’];

var favFruit = fruit[0];

// favFruit equals ‘apple’
A type of variable that stores a list of data instead of just one value. Arrays can store words and numbers like variables, but also other variables.
To get the value of one array item, call the list number of it. Note that arrays begin counting at 0 instead of 1.
For Loop | read more
for(var i = 0; i < numberOfTimes; i++) {
    alert(“This has run ” + i + ” out of ” + numberOfTimes + ” times.”);
}
Loops are handy if you want to run the same code over and over again, each time with a different value.
A loop takes a temporary var i, which starts at 0, runs a piece of code, then increases by 1. This happens until it reaches the target number of times you want it to run.
Variable Scope | read more
alert(carName);
// ^ this would return “undefined”

function myFunction() {
    var carName = “Volvo”;

}
The places a variable can be used is affected by where it was made: a variable created inside a function will only be remembered inside that function. A variable made outside of any function can be used in any function. This is called a global variable.Where the global variable is announced on the page doesn’t matter, as long as it’s above whatever code uses it (however functions don’t care because they are called after the page reads the script the first time through).
Comments | read more
// I’m commenting on this situation
Comments are just as useful as they are in any other coding language: They are used to leave messages, define code sections, and “cross out” unwanted code without having to delete it entirely. This syntax is the only difference between JavaScript comments and other languages.
about Beth
Beth is the Senior Marketing Manager at BSD Education.
She is focused primarily on full-stack marketing strategy, data analytics, and email marketing at BSD. Beth has over eight years of experience working with several industries globally, and operates a full-stack marketing consultancy based in Bath.

other posts in

Real-Life Work Experience For High School Students

A high school internship is the best way to gain work experience, develop your professional skills, and fast-track a career.

Fill in this form to learn more about how students will benefit today!