Know and point out to students the limits of Khan Academy’s JavaScript environment, which does not allow some important topics (like variable scoping) to be demonstrated.

  • Khan Academy’s debugger is strict about coding conventions to create a safe, sandboxed environment.
  • As a result, for example, you cannot create a variable without using the keyword var.
    • The fact that, outside of this environment, you can create variables without using the keyword var may cause problems for students once they are outside the sandboxed environment.
    • Variables declared without the var keyword are global variables.
    • The only way variables are scoped is through functions. Students may end up confused about the scope of the variables in a program.
  • Other common issues that are not obvious in Khan Academy's environment:
    • if/else blocks
      • What happens when you don’t use curly braces?
    • Alert boxes / console message logging.
      • Alert boxes are not a part of the sandboxed environment, which makes them hard to explain.
    • Debugging can be difficult to teach since the Khan Academy debugger alerts students of code errors rather than requiring students to think about methods they can use to debug their code.
  • Without this environment, however, teaching JavaScript to novices would be difficult because students would likely make many errors.
    • These errors could some students to become confused, discouraged, and overwhelmed.

More about this tip

External Source

Interview with Karen Doore