Basically text.
var screepName = 'screepalicious';Basically a list or group of things, which can be of varying types.
var myDumbArray = ['a', 'b', 'c', 1, 2, 3, screepName];Each item in the array has an index number. Index numbers start at 0 (not 1), so if you wanted to reference the letter a (the first item in the array above), it would look like myDumbArray[0]. For example:
console.log(myDumbArray[0]); // 'a'
/* or */
var someNewThing = myDumbArray[3]; // 1
/* or */
var someOtherNewThing = myDumbArray[6]; // 'screepalicious' (the value of screepName)It's...an object!
var myDumbObject = {
temperature: 68,
humidity: 40,
name: 'bob',
};Objects are made up of key/value pairs (properties). In the object above, temperature would be the key, 68 would be the value. You can access or reference properties like this:
var howColdIsIt = myDumbObject.temperature; // 68Objects can have many levels of nested values.
var config = {
roles: {
harvesters: {
population: 2,
preferSource: 1,
},
upgraders: {
population: 3,
preferSource: 0,
},
}
};If we wanted to get the value of population for the harvester role of the In the object above, it would be:
var harvesterPop = config.roles.harvesters.population; // 2Here's a few examples of ways you can use console log.
var screepName = 'screepalicious';
var creep = {
name: screepName,
role: 'harvester',
};
console.log(screepName); // screepalicious
console.log('The creeps name is: ', screepName); // The creeps name is: screepalicious
console.log(`The creeps name is: ${screepName}`); // The creeps name is: screepalicious
console.log(JSON.stringify(creep)); // NOTE: objects need to be converted to strings first to log.