Skip to content
All courses
JavaScriptBeginner

JavaScript Fundamentals

Write your first JavaScript from scratch. Store values, make decisions, loop over lists, work with text, write functions and organise data with objects, then pull it all together in three small projects.

Free to browse. You sign in at the first lesson so your progress is saved.

What you will be able to do

  • Store and update values with const and let, and print clear, labelled output
  • Make decisions in code with if, else if and logical operators
  • Loop over arrays to count, total and pick out data
  • Write functions that take inputs and return results
  • Model real data with objects and lists of objects

Syllabus

7 modules and 28 lessons. Each lesson is a short read followed by an exercise with tests.

Module 1

Variables and types

Store values in variables, do sums with numbers and build text you can print.3 lessons, about 34 min
  1. 1Storing valuesCreate variables with const and let, and print them with console.log.10 min
  2. 2Doing sumsUse arithmetic operators, brackets and shortcuts like += to calculate values.12 min
  3. 3Joining textCombine strings with + and build sentences with template literals.12 min
Module 2

Making decisions

Compare values and choose what your program does with if, else if and logical operators.3 lessons, about 38 min
  1. 4If and elseCompare values to get true or false, then run different code for each.12 min
  2. 5More than two choicesChain conditions with else if, and put them in the right order.12 min
  3. 6Combining conditionsJoin conditions with && (and), || (or) and ! (not).14 min
Module 3

Arrays and loops

Keep lists of values in arrays and repeat work with for...of and while loops.5 lessons, about 1 hour
  1. 7Looping over a listStore several values in an array and visit each one with for...of.12 min
  2. 8Positions and lengthRead items by their index, count them with length and add to the end with push.12 min
  3. 9Adding up a listKeep a running total as a loop goes through an array.14 min
  4. 10Picking out itemsPut an if inside a loop to keep or count only the items you want.14 min
  5. 11Repeating with whileRepeat code for as long as a condition stays true, and count with a classic for loop.14 min
Module 4

Working with text

Change, search, split and format strings with JavaScript's built-in string methods.5 lessons, about 1 hour
  1. 12Length and caseCount characters, read single letters and change text to upper or lower case.12 min
  2. 13Tidying textRemove stray spaces with trim and swap text with replace and replaceAll.12 min
  3. 14Searching textCheck what a string contains with includes, startsWith, endsWith and indexOf.12 min
  4. 15Splitting and joiningTurn text into an array with split, and an array back into text with join.12 min
  5. 16Numbers inside textTurn text into numbers with Number, and format numbers as prices with toFixed.14 min
Module 5

Functions

Package code into reusable functions with inputs, return values and sensible defaults.5 lessons, about 1 hour
  1. 17Writing a functionDefine a function with a parameter, return a result and call it.14 min
  2. 18Several inputsWrite functions that take more than one parameter, in the right order.12 min
  3. 19Default valuesGive a parameter a fallback value for when the caller leaves it out.12 min
  4. 20Where variables liveUnderstand scope: which parts of your code can see which variables.14 min
  5. 21Arrow functions, map and filterWrite short arrow functions and pass them to map and filter to transform arrays.16 min
Module 6

Objects

Group related values into objects, change them, and work with lists of them.4 lessons, about 52 min
  1. 22Grouping data in an objectCreate an object with named properties and read them with dots and square brackets.12 min
  2. 23Changing an objectUpdate existing properties and add new ones.12 min
  3. 24Lists of objectsStore many records in an array of objects and loop over them.14 min
  4. 25Looping over an objectVisit every property with Object.keys, Object.values and Object.entries.14 min
Module 7

Putting it together

Combine everything from the course to build three small, complete programs.3 lessons, about 1 hour
  1. 26Project: a café receiptPlan a small program in steps and build a receipt from a list of orders.20 min
  2. 27Project: counting wordsUse an object as a tally to count how often each word appears.20 min
  3. 28Project: a departures boardCombine objects, functions, conditions and loops to build a station departures board.25 min

After this course

Where to go next

This course builds on what you learn in JavaScript Fundamentals.

  • JavaScriptIntermediate

    Modern JavaScript

    Write JavaScript the way working developers do: destructuring, array methods, closures, classes, Map and Set, error handling and async code with promises.

    Recommended first: JavaScript Fundamentals

    • 23 lessons
    • About 6 hours