Study Runtime Behavior
Use PythonTutor to study how JavaScripts executes your solution step-by-step at runtime. Take 2+ test cases and fill out a new markdown for each in the "/step-through" directory, include:
- A permalink to your PythonTutor step-through
- A description of this test case and why it is interesting
- Your solution and test-case as a snippet
- For each step:
- A prediction of what will happen
- What actually happened (as indicated in PythonTutor)
- An explanation of what JavaScript did & how your prediction was correct or incorrect
This step is one of the most important parts of this entire project, it's by carefully stepping through your code that you will learn how JS works behind the scenes. Being able to step through code in your mind is one of the key skills that separates beginner programmers from experts. Carefully filling out your step-through markdowns is the most effective way to build this skill-set.
JS Notional Machine
The notional machine is a mental model your brain builds to understand what JavaScript does during program execution. These notional machines don't need to be precise down to the physical chips, instead they need to accurately describe what is relevant to the task at hand. At the beginning this list includes:
- How JS steps through a file
- Source code vs. runtime application
- Variable initialization & reassignment
- Functions:
- Definition vs. Execution
- Are Objects and executable procedures
- Scope vs. Context
- Execution contexts ("Frames" in pythontutor)
Your brain will construct an understanding of how JS works whether or not you intentionally guide it, it's what brains do. As great as this sounds it is really very dangerous. JavaScript is complicated and it is very easy to come up with explanations that work for simple Codewars but are not accurate. You won't notice at first, but as soon as you try to move on you will find it nearly impossible to understand what's going on. Unlearning and relearning how JavaScript executes is very difficult and will take a lot of time.
So stick to it! This step isn't very glamorous but it will set you up for long-term success.