Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

CodeSignal

Making Decisions and Repeating Work in JavaScript

via CodeSignal

Overview

Real programs choose what to do and repeat work instead of running the same short list of steps every time. Here you'll run code only when a condition holds, pick between two paths and then between many, repeat a block a fixed number of times with a counting loop, and build up a running total as the loop goes round.

Syllabus

Running Code Only When a Condition Holds

  • Predict, Then Run
  • Print Only When Above a Limit
  • Add the Other Branch
  • Check Whether the Shop Can Serve

Handling Many Cases with else if

  • Trace the Chain
  • Sort a Value into Three Ranges
  • Catch Everything Left
  • Fix the Order

Repeating a Fixed Number of Times with for

  • Trace a Loop
  • Repeat a Message
  • Number Each Pass
  • Print a Price List

Building Up a Total While Repeating

  • Total Up the Sales
  • Show the Running Total
  • Apply the Happy-Hour Rate
  • Report the Day

Reviews

Start your review of Making Decisions and Repeating Work in JavaScript

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.