As you’ll discover in the next parts, the JSContext class is our mean for exposing Swift code to JavaScript, and JavaScript code to Swift. Inside a virtual machine (JSVirtualMachine) you can have multiple contexts, and you can pass data between them.
This class is the actual environment (context) that executes your JavaScript code. On the other hand, the class that you’ll be dealing the most with, is JSContext. It’s possible to have multiple virtual machines running in an app, but they cannot exchange any data directly. In the JavaScriptCore framework, the JSVirtualMachine class represents programmatically that virtual machine, but usually you won’t have to deal directly with it. First off, JavaScript execution has its own environment, or to put it in a better way, a virtual machine where it runs into. Now that you feel the excitement too, let me underline a few necessary technical details. Of course, you can think more than the above, but even these are good reasons to make you want to get started with JavaScript in iOS.