JavaScript fundamentals
Variables, functions, arrays and objects.
Level 101 · 20 lessons · 18 practice labs
Lessons
Language basics
- Adding scripts and the console: You will add JavaScript to a page and try small experiments in the browser console to see the output.
- let, const and types: You will declare variables with let and const, tell changeable values from fixed ones and recognise the basic data types.
- Operators and equality (== vs ===): You will use operators and understand the difference between == and ===, and why strict equality is safer.
- Conditions: You will write code that takes a different path depending on a condition using if and else.
- Loops: You will write loops that repeat a task many times and decide when they stop.
- Template literals: You embed variables in text with backticks and produce multi-line strings.
- String methods: You split, search, trim and replace text with built-in string methods.
- The Math and Date objects: You round numbers, work with dates, and know Math.random must never be used for security.
- Short task: a tip calculator
Functions and data
- Functions: You will put repeated work into a named function, pass data in and get a result back.
- Arrow functions: You write short functions with arrow syntax and know how they differ from traditional functions.
- Scope and hoisting: You predict where a variable is visible and avoid surprises caused by var.
- Arrays: You will store several values in an array, add items and walk through them.
- Objects: You will group related information in an object as property and value pairs and read it back.
- Destructuring and spread: You pull values out of arrays and objects in one line, then copy and merge them.
- Error handling with try/catch: You catch errors and show users a plain message without leaking technical detail.
- Short task: a grade book
Talking to the page
- The DOM: selecting and updating: You will select elements on a page with JavaScript and change their text and look while the page is open.
- Events and the event object: You will write code that reacts to clicks and typing and read information from the event object.
- Capstone: an interactive page: You build a small interactive page for a fictional company's team where content changes when a button is clicked.
Practice labs
- Find the type mistake in the cart total: Kumbara Market's cart total shows "1002" as text; find where strings and numbers get mixed and fix the total.
- Clean up loose equality traps: A discount-code check lets empty values through because of ==; rewrite the comparisons with === and test them.
- Convert form data to the right types: Convert the age, quantity and consent values from a signup form to the right types and catch NaN and empty inputs.
- Work out the shipping fee with conditions: Write if/else code that calculates Mavikuş Kargo's fee from its weight and region rules.
- Stop the infinite loop: A while loop that counts stock freezes the browser; find the bug in its exit condition and fix it.
- Generate a shift rota with loops: Use nested loops to build a fair seven-day rota for four employees and print it into a table.
- Write an order summary with a template literal: Turn a messy chain of + joining name, product and amount into a readable template literal.
- Normalise phone numbers: Use string methods to convert customer phone numbers typed in different formats into a single format.
- Count the days until delivery: Use Date to find an order's estimated delivery date and the days left, skipping weekends.
- Move repeated code into a function: Turn a VAT calculation copied in three places into one function with parameters.
- Fix an undefined caused by hoisting: Fix a price calculation that returns undefined because a variable is used before it is declared.
- Separate counters with scope: Make two click counters that share one global variable independent of each other using scope.
- Build an array of product objects: Convert five products given as plain text into objects with name, price and stock fields in an array.
- Unpack nested data with destructuring: Pull the address and last order out of a customer record in one line with destructuring and defaults.
- Don't mutate the settings by accident: A settings object you thought was copied also changes the original; make a safe copy and merge with spread.
- Expand a description on click: On Defne Kitabevi's page, write code that expands a book description when "Read more" is clicked.
- Control a quantity counter with the keyboard: Use the key on the event object to build a quantity counter that goes up and down with the arrow keys.
- Don't crash the page on bad input: A field where users paste JSON halts the whole page on bad data; catch the error with try/catch and show it to the user.
About this course
Variables, functions, arrays and objects.
What you will learn
- Language basics
- Functions and data
- Talking to the page
Prerequisites
No prior knowledge is needed; the course starts from zero.
Lab environment
Lessons run on your own Kali Linux desktop in the browser, with the tools ready in their windowed interfaces. Nothing to install; a computer screen is recommended.
Frequently asked questions
- Is this course right for my level?
- The course is at beginner level; every term is explained where it first appears.
- Is there anything to install?
- No. Every lesson runs in your own lab environment that opens in the browser.
- How do lessons work?
- Each lesson has 8 to 10 steps and a short quiz. Early steps show the command to type, later steps give less help; if two attempts fail, the solution opens.
- Can I try it for free?
- Yes. The first three lessons of every course are free.