MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "warnings": {
        "main": {
            "*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
        },
        "revisions": {
            "*": "Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
        }
    },
    "query": {
        "pages": {
            "4": {
                "pageid": 4,
                "ns": 0,
                "title": "Variable",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "A variable is a name in memory that points to a [[Value|value]]. Variables help us keep track of values in memory so that we can always access them within our programs. We can give variables names so that it is easier to access them in our programs. We can also access and change the values of variables whenever we choose to.\n\n==Creating Variables in JavaScript==\nVariables in JavaScript follow a simple convention listed below:\n\n<source lang=\"javascript\">\nvar name;\n</source>\n\nTo create a variable in JavaScript, we first must use the '''var''' keyword. After the keyword we can add a '''name'''. The name of a variable can be anything of our choosing. However, it is a good practice to name the variable according to the content it stores.\n\n===Examples of Variables===\nThe following code shows how to create three different variables. It is good practice to use [[Camel Case|camel case]] to name your variables.\n<source lang=\"javascript\">\nvar highScore;\nvar gameOverString;\nvar isGameOver;\n</source>\n\nWe can also assign values when we create variables.\n<source lang=\"javascript\">\nvar highScore = 1000;\nvar gameOverString = \"Game Over!\";\nvar isGameOver = false;\n</source>\n\nAnother way to assign values would be to create the variable first, then assign the value later.\n<source lang=\"javascript\">\nvar highScore;\nvar gameOverString;\nvar isGameOver;\n\nhighScore = 1000;\ngameOverString = \"Game Over!\";\nisGameOver = false;\n</source>\n\n===Allowed Characters===\nVariables are only allowed to have letters, numbers, underscores, or dollar signs. But, one thing to note is that '''variables can't start with a number'''!\n\n<source lang=\"javascript\">\nvar name;   //Good!\nvar _name;  //Still good!\nvar $name;  //This works good too!\nvar 1name;  //No! No! No! Error!\n</source>\n\nIf the variable name has other characters that are not letters, numbers, underscores or dollar signs, then the variable is invalid.\n<source lang=\"javascript\">\nvar na1me;  //Good!\nvar na$me;  //Still good!\nvar na_me;  //You best believe it's good!\nvar na%me;  //No! Error! % is not allowed in variable names!\nvar ~name;  //No again! Error! ~ is not allowed in variable names!\n</source>\n\n===Reserved Words===\nWe must be careful with the naming of our variables. Some words are reserved for JavaScript, meaning that JavaScript does not allow us to use the exact words as variable names. The following is a list of words that have been reserved<ref>Mozilla Developer Network - [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Reserved_Words \"Reserved Words in JavaScript\"]</ref>.\n\n<source lang=\"text\">\nbreak          case          catch          continue          debugger\ndefault        delete        do             else              finally\nfor            function      if             in                instanceof\nnew            return        switch         this              throw\ntry            typeof        var            void              while\nwith\n</source>\n\nHowever, just because the words are reserved doesn't mean we can't fully use them. It just means we have be more descriptive with the name. The following shows examples of how we can still use the reserved names in our own variable names.\n\n<source lang=\"javascript\">\nvar new;       // This is an error. We can't create a variable with a reserved name.\nvar newImage;  // Although we used the reserved word \"new\", this is fine since it's not the exact word.\n\nvar return;       // Error, \"return\" is a reserved word.\nvar returnValue;  // This works fine!\n</source>\n\n==References==\n<references/>"
                    }
                ]
            }
        }
    }
}