You must declare variables in Javascript. This line creates a **global** variable `p`. Please use `var p = ...` instead.