Section 5 Sp 11

From CSE190M-Admin

Jump to: navigation, search

[edit] Links

.

[edit] Debugging Process

.

[edit] Order-It

  • Refresh JavaScript + Arrays and events like onclick

In order of easy to harder mode It's recommended to do a a few of the easy ones, a few of the hard. Some are similar, choose a favorite!

  • Clear All: Deletes all text from the text area.
  • Capitalize: Converts the text to upper case.
  • Sort: Rearranges the lines into sorted alphabetical order.
  • Reverse: Reverses the order of the lines.
  • Add Line Numbers: Places a number in front of each line, such as "1. " (Don't worry about the possibility that the lines might already have numbers in front of them.)
  • Strip Blank Lines: Removes any blank/empty lines from the text area.
  • Shuffle: Rearranges the lines into a random order. JavaScript doesn't have a shuffle method for arrays, but you can write one using the following algorithm:
for each index i:
   randomly choose an index j >= i.
   swap lines i and j.

- Shuffle could be a bit counter-intuitive. They might want to just pick random indexes, so try to guide them towards the idea of i + random ( i -> length-i)