O'Reilly logo
  • Ahmed Elgendy thinks this is interesting:

Now that you know how to represent the ships and the hits, let’s get some code down. First, we’ll create the model object, and then take the ships data structure we just created, and add it as a property. And, while we’re at it, there are a few other properties we’re going to need as well, like numShips, to hold the number of ships we have in the game. Now, if you’re asking, “What do you mean, we know there are three ships, why do we need a numShips property?” Well, what if you wanted to create a new version of the game that was more difficult and had four or five ships? By not “hardcoding” this ...

From

Cover of Head First JavaScript Programming

Note

How to not hard-code a program?