Open original
Info
Demo 4.17

Diagnosing bugs (fixed)

Files in this demo

├─ index.html
├─ style.css
└─ script.js

Here’s the fixed version of the previous demo! These are the 4 bugs that were fixed.

  1. 1changeText("Ready to click!"; was missing its closing ). Missing brackets are syntax errors, which stop the entire script from running.
  2. 2"myElement" was missing the #, so it couldn’t find the element and returned null.
  3. 3newtext should be newText. JavaScript is case-sensitive, so these are two different variables!
  4. 4red was missing quotes. Without quotes, JavaScript thinks it’s a variable name, not a string.
Next demoExercise: type specimen
Keyboard Shortcuts
⌘ Z / ⌘ ⇧ ZCtrl Z / Ctrl ⇧ Z Undo / redo
Tab / ⇧ TabTab / ⇧ Tab Indent / unindent selection
⌘ ] / ⌘ [Ctrl ] / Ctrl [ Indent / unindent lines
⌘ ACtrl A Select all
⌘ DCtrl D Select next occurrence of selection
⌥ ClickAlt Click Add another cursor
⌘ /Ctrl / Comment / uncomment lines
Ctrl SpaceCtrl Space Autocomplete
Ctrl EnterCtrl Enter Reset layout
⌘ ⌥ [ / ⌘ ⌥ ]Ctrl ⇧ [ / Ctrl ⇧ ] Fold / unfold block
Code
The editor didn't load — try refreshing the page. Navigation, shortcuts and the info panel still work in the meantime.
Preview
Dimensions0 × 0
Delay
Console
›