OK, OK, we know that Python is whitespace-delimited: tabs matter! However, JavaScript really doesn't care about whitespace in most cases. As we saw before, indentation and whitespace is a matter of style, not syntax.
So here's the thing: when I was first learning Python, the idea of a language that was whitespace-dependent was abhorrent. "How could a language that could break with an improper IDE setting survive?", I thought. My opinions aside, the good news is that indentation in Python is parallel to indentation plus curly braces in JavaScript.
Here's an example:
Python | JavaScript |
def hello_world(x): |
function helloWorld(val) { |
If you notice, our if statement inside our Python function is indented in the same way that this JavaScript example is indented, albeit without the curly braces. So yay...