Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    JSJavaScript

    Getting started

    • What is JavaScript?
    • Variables: let, const and var
    • Data types
    • Type conversion

    Operators and strings

    • Arithmetic and assignment
    • Comparison and logic
    • Strings and template literals
    • String methods
    • Numbers and Math

    Control flow

    • Conditions: if and else
    • switch and the ternary operator
    • Loops: for and while
    • Challenge: FizzBuzz

    Functions

    • Functions
    • Arrow functions
    • Parameters: default, rest and spread
    • Scope and closures
    • Callbacks and higher-order functions

    Arrays

    • Array basics
    • map, filter and find
    • reduce and sorting
    • Destructuring

    Objects

    • Object basics
    • Copies and references
    • Methods and this
    • JSON and optional chaining

    Classes and OOP

    • Classes
    • Inheritance

    JavaScript in the page

    • Controlling the page (DOM)
    • Creating elements
    • Events
    • Forms and validation
    • Saving in the browser (localStorage)

    Errors and async

    • Handling errors: try and catch
    • Timers and the event loop
    • Promises
    • async and await
    • Fetching data from an API

    Practical tools and techniques

    • Searching with regular expressions
    • Cancellation and stale results
    • Testing and debugging JavaScript

    Modern JavaScript and a project

    • Map and Set
    • Dates and localised formatting
    • Modules: import and export
    • Project: a complete to-do app
    JavaScript

    Control flow · Lesson 13 of 45

    Challenge: FizzBuzz

    The most famous interview question, with conditions and loops.

    8 minutes2 games

    Important

    Only one branch of an if/else if chain runs. Test overlapping cases before broader cases.

    The task: print the numbers 1 to 15, except:

    • multiples of 3 print Fizz instead,
    • multiples of 5 print Buzz,
    • multiples of both print FizzBuzz.

    Interviewers love it because it shows whether you understand the order of conditions.

    Interview question

    Why must the “both” case (15) be checked first?

    Order the lines

    Put the conditions in the right order inside the loop.

    1. Click the lines in the right order

    Exercise

    Write FizzBuzz from 1 to 15.

    Expected output:
    1
    2
    Fizz
    4
    Buzz
    Fizz
    7
    8
    Fizz
    Buzz
    11
    Fizz
    13
    14
    FizzBuzz
    JavaScript
    for (let i = 1; i <= 15; i++) {
      
    }
    

    Learn more from

    • Wikipedia: Fizz buzzen.wikipedia.org
    • javascript.info: Loops: while and forjavascript.info

    Played 0 of 2 games

    Sign in to save your progress and earn XP.

    PreviousLoops: for and whileNextFunctions
    SeaCode

    Learn to code for real, online or at our branch in front of Cairo University, Giza.

    Learn

    • All courses
    • Interactive tutorials
    • Interview practice problems
    • Mock interview
    • Learning tracks
    • Code Arena
    • Workshops & Events
    • Knowledge library
    • Team projects

    Your account

    • Log in
    • Sign up
    • Learning plan
    • Certificates
    • Site map

    Contact us

    • WhatsApp
    • 010 9094 1104
    • In front of Cairo University, Giza

    © 2026 SeaCode. All rights reserved.