In fact, the final result will vary depending on the actual value of x. Now, we have no predefined results for this calculation. However, take a look at the following tweak: 2 * x + 1 So why should we execute this calculation every time? We could just write the result, and save some time. This operation always equals 11, no matter what. In both cases, the processing is deterministic, so the same initial values will always result in the same results. In coding, like in math, you process data and obtain some results. To answer this question, we can start with a use case. That’s simply because they allow you to process and store data very simply. Indeed, pretty much every programming language has the concept of variable. Variables are not something unique to Javascript. If you are new to Javascript, this tutorial is for you! However, if you have no clue on how to create a Javascript file or how to run it, you should read our Getting Started with JS tutorial first. In this Javascript tutorial, we will see what are variables, and how to use them. In other words, you absolutely need variables. With them, your code can do different things in different circumstances. In fact, they are the main item that allows your code to work dynamically. With variables, you can start to unleash the full potential of JavaScript.
0 Comments
Leave a Reply. |