// Numbas version: exam_results_page_options {"name": "Separate thousands with commas using custom functions", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variablesTest": {"maxRuns": 100, "condition": ""}, "rulesets": {}, "variables": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Display a number like \"1234\" as \"1,234\".

\n

This question is out of date: the formatnumber function can format numbers using several different notational styles.

"}, "functions": {"comma": {"definition": "separate(n,',')", "type": "string", "language": "jme", "parameters": [["n", "number"]]}, "separate": {"definition": "var s = n+'';\nvar over = s.length%3;\nvar out = s.slice(0,over);\nvar i = over;\nwhile(iA

", "tags": [], "preamble": {"css": "", "js": ""}, "ungrouped_variables": [], "statement": "

{comma(123)}

\n

{comma(1234)}

\n

{comma(1234567)}

\n

{separate(123,' ')}

\n

{separate(1234,' ')}

\n

{separate(1234567,' ')}

", "parts": [{"variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "showFeedbackIcon": true, "type": "information", "scripts": {}, "marks": 0}], "extensions": [], "type": "question", "variable_groups": [], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}