Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Here are some ideas:

  • Use either tab or, preferably, 4-spaces for indention consistently. Right now the indention is all screwy on JSBin.
  • Put all your variable declarations at the top, even if you don't define them yet. This'll prevent any confusion from variable hoisting variable hoisting.
  • Since null is a falsy value, you can change document.getElementById(...) !== null to document.getElementById(...) to check for the existence of an element in you if statements.
  • Space out your if statements (so if (...) instead of if(...).)
  • Maybe think about using jQuery? It'll make working with events and elements much easier than using the DOM directly. So for example, hiding all the pages could be written as easy as: $('div').hide().

That's all I have time for now!

Here are some ideas:

  • Use either tab or, preferably, 4-spaces for indention consistently. Right now the indention is all screwy on JSBin.
  • Put all your variable declarations at the top, even if you don't define them yet. This'll prevent any confusion from variable hoisting.
  • Since null is a falsy value, you can change document.getElementById(...) !== null to document.getElementById(...) to check for the existence of an element in you if statements.
  • Space out your if statements (so if (...) instead of if(...).)
  • Maybe think about using jQuery? It'll make working with events and elements much easier than using the DOM directly. So for example, hiding all the pages could be written as easy as: $('div').hide().

That's all I have time for now!

Here are some ideas:

  • Use either tab or, preferably, 4-spaces for indention consistently. Right now the indention is all screwy on JSBin.
  • Put all your variable declarations at the top, even if you don't define them yet. This'll prevent any confusion from variable hoisting.
  • Since null is a falsy value, you can change document.getElementById(...) !== null to document.getElementById(...) to check for the existence of an element in you if statements.
  • Space out your if statements (so if (...) instead of if(...).)
  • Maybe think about using jQuery? It'll make working with events and elements much easier than using the DOM directly. So for example, hiding all the pages could be written as easy as: $('div').hide().

That's all I have time for now!

Source Link
theabraham
  • 163
  • 1
  • 5

Here are some ideas:

  • Use either tab or, preferably, 4-spaces for indention consistently. Right now the indention is all screwy on JSBin.
  • Put all your variable declarations at the top, even if you don't define them yet. This'll prevent any confusion from variable hoisting.
  • Since null is a falsy value, you can change document.getElementById(...) !== null to document.getElementById(...) to check for the existence of an element in you if statements.
  • Space out your if statements (so if (...) instead of if(...).)
  • Maybe think about using jQuery? It'll make working with events and elements much easier than using the DOM directly. So for example, hiding all the pages could be written as easy as: $('div').hide().

That's all I have time for now!

default

AltStyle によって変換されたページ (->オリジナル) /