Bitpath

Boss lesson · Unit 03

A text toolkit

A palindrome check, a vowel counter and a Caesar shift

13 exercisesabout 3 min

What you practise

  • Small typed functions built and combined: a palindrome check, a vowel counter, a Caesar shift, each checked against answers you know

Try a question from this lesson

Pick one

A palindrome reads the same backwards: level, noon. Plan before you code. Which steps check any word?

The idea

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

Positions in a string

The characters of a string are numbered, and the numbering starts at 0, not 1. The number is called a position, or index.

abc.indexOf("d") asks: at which position is this character?

abc[3] asks the opposite: which character is at this position?

With 26 letters, the positions run from 0 to 25.

TypeScript
const abc = "abcdefghijklmnopqrstuvwxyz";
console.log(abc.indexOf("a")); // 0
console.log(abc.indexOf("d")); // 3
console.log(abc[3]);           // d
console.log(abc[25]);          // z

11 more exercises in the app

  • 4× type the answer
  • 1× order the lines
  • 3× multiple choice
  • 1× true or false
  • 2× fill the blanks

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy