PNL Learn

Intro to JavaScript

The language of the web, from variables to loops.

JavaScript is the one language every browser runs. You will see where it runs and how a page loads a script, then learn the language itself: const and let, the primitive types and how to convert between them, strings and template literals, every everyday operator (including why === beats == and why ?? beats || for defaults), if, switch and truthiness, alert, confirm and prompt, arrays and objects as records, and every kind of loop. Each idea is practiced in small programs that are checked by tests, and the course ends with a shopping cart with tax tiers, a grade report, a word counter, FizzBuzz and a password rule checker. If you already know Python, the course calls out every place JavaScript behaves differently.

BeginnerJavaScript8 lessons88 exercisesAbout 5.5 h
Create a free account

What you will learn

  • Script loading and the console
  • const, let and the primitive types
  • Type conversion
  • Strings and template literals
  • Operators and equality
  • if, switch and truthiness
  • alert, confirm and prompt
  • Arrays and objects
  • Loops

Lessons

  1. 1

    JavaScript and the Browser

    What runs your JavaScript, the tools you use, console.log, and how a page loads a script.

    12 exercises

  2. 2

    Variables and Types

    Declare with const and let, finish a function, meet the primitive types and convert between them on purpose.

    13 exercises

  3. 3

    Strings

    Quotes and escapes, template literals, the + trap, indexes and slices, and the everyday string methods.

    11 exercises

  4. 4

    Operators

    Arithmetic and compound assignment, === versus ==, comparing text, &&, || and ??, the ternary and precedence.

    11 exercises

  5. 5

    Decisions and User Input

    if, else if and nested conditions, truthy and falsy values, switch with break, and alert, confirm and prompt.

    11 exercises

  6. 6

    Arrays and Objects

    Arrays and their everyday methods, which ones change the array, and objects as records with dot and bracket access.

    11 exercises

  7. 7

    Loops

    while and do...while, the counting for loop and off-by-one, for...of and for...in, and break and continue.

    11 exercises

  8. 8

    Putting It Together

    Plan a program from its contract, then build a cart with tax tiers, a grade report, a word counter, FizzBuzz and a password checker.

    8 exercises

How you practice

You practice in the browser and every exercise gives you feedback right away. This course uses these formats:

  • Code exercise: 29
  • Fix the bug: 17
  • Predict the output: 14
  • Type the answer: 9
  • Fill in the blank: 7
  • Multiple choice: 4
  • Spot the bug: 3
  • Match the pairs: 2
  • Select all that apply: 2
  • Reorder lines: 1

Aligned to

CS2023ACM / IEEE-CS / AAAISource
  • Software Development Fundamentals
    • SDF-FundamentalsFundamental Programming Concepts and Practices
JSE-40-01: Certified Entry-Level JavaScript ProgrammerJS InstituteSource
  • Basics of JavaScript and Computer Programming
    • 1.1.1Understand fundamental terms and definitions
    • 1.2.1Set up the programming environment
    • 1.3.1Explain client-side execution of JavaScript code
  • Variables, Data Types, and Type Casting
    • 2.1.1Use variables effectively
    • 2.2.1Use the primitive types boolean, number, bigint, undefined and null
    • 2.3.1Use the string type
    • 2.4.1Perform type casting
    • 2.5.1Use objects as records
    • 2.6.1Use arrays
  • Operators and User Interaction
    • 3.1.1Use assignment, arithmetic and string operators
    • 3.2.1Use logical and comparison operators
    • 3.3.1Use the ternary, typeof, instanceof and delete operators
    • 3.4.1Apply operator precedence and associativity
    • 3.5.1Interact with the user through alert, confirm and prompt
  • Control Flow
    • 4.1.1Make decisions with if and if...else
    • 4.2.1Make decisions with switch
    • 4.3.1Loop with while, do...while, break and continue
    • 4.4.1Loop with for
    • 4.5.1Loop over keys with for...in
    • 4.6.1Loop over iterables with for...of
MDN Curriculum (core)MozillaSource
  • JavaScript fundamentals
    • 6.1Variables
    • 6.2Math
    • 6.3Text
    • 6.4Arrays
    • 6.5Conditionals
    • 6.6Loops
    • 6.8Object basics

Proto Node Labs is not affiliated with or endorsed by ACM / IEEE-CS / AAAI, JS Institute and Mozilla. Exam names are trademarks of their owners.