Command Palette

Search for a command to run...

Hectal
Phase 16: Dashboards in Production
Data Visualization · Exercise 4 of 5 PreviousNext
Intermediate

A CSV cell that survives commas

csvCell(value) must make one safe CSV cell: empty for null, undefined and NaN; wrapped in quotes when it has a comma, a quote or a line break (inner quotes doubled); and prefixed with ' when a text starts with =.

Numbers stay as they are: -3 is -3.

What Check tests

  1. A plain text is unchanged
  2. A comma gets quotes
  3. A quote is doubled and wrapped
  4. A formula text gets a ' in front
  5. A negative number stays a number
  6. null and NaN are empty

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.