feat(seed): reformat seed/challenges JSON via repack script
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
14c9ed8974
commit
52ca2b9ad6
@ -37,13 +37,13 @@
|
||||
"<hr>",
|
||||
"To pass the test on this challenge, change your <code>h1</code> element's text to say \"Hello World\"."
|
||||
],
|
||||
"challengeSeed": ["<h1>Hello</h1>"],
|
||||
"challengeSeed": [
|
||||
"<h1>Hello</h1>"
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"text":
|
||||
"Your <code>h1</code> element should have the text \"Hello World\".",
|
||||
"testString":
|
||||
"assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), 'Your <code>h1</code> element should have the text \"Hello World\".');"
|
||||
"text": "Your <code>h1</code> element should have the text \"Hello World\".",
|
||||
"testString": "assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), 'Your <code>h1</code> element should have the text \"Hello World\".');"
|
||||
}
|
||||
],
|
||||
"type": "waypoint",
|
||||
@ -130,7 +130,9 @@
|
||||
"<hr>",
|
||||
"Add an <code>h2</code> tag that says \"CatPhotoApp\" to create a second HTML <code>element</code> below your \"Hello World\" <code>h1</code> element."
|
||||
],
|
||||
"challengeSeed": ["<h1>Hello World</h1>"],
|
||||
"challengeSeed": [
|
||||
"<h1>Hello World</h1>"
|
||||
],
|
||||
"tests": [
|
||||
"assert(($(\"h2\").length > 0), 'message: Create an <code>h2</code> element.');",
|
||||
"assert(code.match(/<\\/h2>/g) && code.match(/<\\/h2>/g).length === code.match(/<h2>/g).length, 'message: Make sure your <code>h2</code> element has a closing tag.');",
|
||||
@ -195,7 +197,10 @@
|
||||
"<hr>",
|
||||
"Create a <code>p</code> element below your <code>h2</code> element, and give it the text \"Hello Paragraph\"."
|
||||
],
|
||||
"challengeSeed": ["<h1>Hello World</h1>", "<h2>CatPhotoApp</h2>"],
|
||||
"challengeSeed": [
|
||||
"<h1>Hello World</h1>",
|
||||
"<h2>CatPhotoApp</h2>"
|
||||
],
|
||||
"tests": [
|
||||
"assert(($(\"p\").length > 0), 'message: Create a <code>p</code> element.');",
|
||||
"assert.isTrue((/hello(\\s)+paragraph/gi).test($(\"p\").text()), 'message: Your <code>p</code> element should have the text \"Hello Paragraph\".');",
|
||||
@ -639,8 +644,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"guideUrl":
|
||||
"https://guide.freecodecamp.org/certificates/add-images-to-your-website"
|
||||
"guideUrl": "https://guide.freecodecamp.org/certificates/add-images-to-your-website"
|
||||
},
|
||||
{
|
||||
"id": "bad87fee1348bd9aedf08816",
|
||||
@ -766,8 +770,7 @@
|
||||
"challengeType": 0,
|
||||
"translations": {
|
||||
"pt-br": {
|
||||
"title":
|
||||
"Crie links para seções internas de uma página com elementos âncora",
|
||||
"title": "Crie links para seções internas de uma página com elementos âncora",
|
||||
"description": [
|
||||
"Além de criar links externos, elementos âncora também podem ser usados para criar links internos, que são links que pulam para diferentes seções dentro de uma mesma página.",
|
||||
"O formato é parecido com um link externo, só que, ao invés de uma URL no atributo <code>href</code>, você usa o símbolo <code>#</code> e uma palavra para descrever a seção para a qual você quer pular.",
|
||||
@ -1449,8 +1452,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"guideUrl":
|
||||
"https://guide.freecodecamp.org/certificates/add-placeholder-text-to-a-text-field"
|
||||
"guideUrl": "https://guide.freecodecamp.org/certificates/add-placeholder-text-to-a-text-field"
|
||||
},
|
||||
{
|
||||
"id": "bad87fee1348bd9aede08830",
|
||||
@ -1618,8 +1620,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"guideUrl":
|
||||
"https://guide.freecodecamp.org/certificates/add-a-submit-button-to-a-form"
|
||||
"guideUrl": "https://guide.freecodecamp.org/certificates/add-a-submit-button-to-a-form"
|
||||
},
|
||||
{
|
||||
"id": "bad87fee1348bd9aedc08830",
|
||||
@ -1696,8 +1697,7 @@
|
||||
]
|
||||
},
|
||||
"ru": {
|
||||
"title":
|
||||
"Используйте HTML5, чтобы сделать заполнение поля обязательным",
|
||||
"title": "Используйте HTML5, чтобы сделать заполнение поля обязательным",
|
||||
"description": [
|
||||
"Вы можете требовать заполнения определённых полей формы, таким образом пользователь не сможет отправить данные формы до их заполнения.",
|
||||
"Например, если бы вы хотели сделать заполнение текстового поля обязательным, вы могли бы добавить слово <code>required</code> внутрь вашего элемента <code>input</code>: <code><input type=\"text\" required></code>",
|
||||
@ -1976,8 +1976,7 @@
|
||||
]
|
||||
},
|
||||
"es": {
|
||||
"title":
|
||||
"Marca botones de radio y casillas de verificación por omisión",
|
||||
"title": "Marca botones de radio y casillas de verificación por omisión",
|
||||
"description": [
|
||||
"Puedes marcar por omisión una casilla de verificación o un botón de radio usando el atributo <code>checked</code>.",
|
||||
"Para ello, sólo tienes que añadir la palabra \"checked\" en el interior de un elemento <code>input</code>. Por ejemplo:",
|
||||
@ -1987,8 +1986,7 @@
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title":
|
||||
"Faça botões de opção e caixas de seleção estarem marcados por padrão",
|
||||
"title": "Faça botões de opção e caixas de seleção estarem marcados por padrão",
|
||||
"description": [
|
||||
"Você pode fazer uma caixa de seleção ou botão de opção estar marcado por padrão usando o atributo <code>checked</code>.",
|
||||
"Para fazer isso, apenas insira a palavra \"checked\" em um elemento <code>input</code>. Por exemplo:",
|
||||
@ -2120,7 +2118,7 @@
|
||||
"<hr>",
|
||||
"Add a <code>DOCTYPE</code> tag for HTML5 to the top of the blank HTML document in the code editor. Under it, add opening and closing <code>html</code> tags, which wrap around an <code>h1</code> element. The heading can include any text."
|
||||
],
|
||||
"challengeSeed": ["", "", ""],
|
||||
"challengeSeed": [],
|
||||
"tests": [
|
||||
"assert(code.match(/<!DOCTYPE\\s+?html\\s*?>/gi), 'message: Your code should include a <code><!DOCTYPE html></code> tag.');",
|
||||
"assert($('html').length == 1, 'message: There should be one <code>html</code> element.');",
|
||||
|
@ -68,7 +68,6 @@
|
||||
""
|
||||
]
|
||||
]
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -36,9 +36,7 @@
|
||||
"<hr>",
|
||||
"Try creating one of each type of comment."
|
||||
],
|
||||
"challengeSeed": [
|
||||
""
|
||||
],
|
||||
"challengeSeed": [],
|
||||
"solutions": [
|
||||
"// Fake Comment\n/* Another Comment */"
|
||||
],
|
||||
@ -1054,7 +1052,9 @@
|
||||
" }",
|
||||
"})();"
|
||||
],
|
||||
"solutions": ["var myStr = \"I am a \\\"double quoted\\\" string inside \\\"double quotes\\\".\";"],
|
||||
"solutions": [
|
||||
"var myStr = \"I am a \\\"double quoted\\\" string inside \\\"double quotes\\\".\";"
|
||||
],
|
||||
"tests": [
|
||||
"assert(code.match(/\\\\\"/g).length === 4 && code.match(/[^\\\\]\"/g).length === 2, 'message: You should use two double quotes (<code>"</code>) and four escaped double quotes (<code>\"</code>).');",
|
||||
"assert(myStr === \"I am a \\\"double quoted\\\" string inside \\\"double quotes\\\".\", 'message: Variable myStr should contain the string: <code>I am a \"double quoted\" string inside \"double quotes\".</code>');"
|
||||
@ -1102,7 +1102,9 @@
|
||||
"tail": [
|
||||
"(function() { return \"myStr = \" + myStr; })();"
|
||||
],
|
||||
"solutions": ["var myStr = '<a href=\"http://www.example.com\" target=\"_blank\">Link</a>';"],
|
||||
"solutions": [
|
||||
"var myStr = '<a href=\"http://www.example.com\" target=\"_blank\">Link</a>';"
|
||||
],
|
||||
"tests": [
|
||||
"assert(!/\\\\/g.test(code) && myStr.match('\\\\s*<a href\\\\s*=\\\\s*\"http://www.example.com\"\\\\s*target\\\\s*=\\\\s*\"_blank\">\\\\s*Link\\\\s*</a>\\\\s*'), 'message: Remove all the <code>backslashes</code> (<code>\\</code>)');",
|
||||
"assert(code.match(/\"/g).length === 4 && code.match(/'/g).length === 2, 'message: You should have two single quotes <code>'</code> and four double quotes <code>"</code>');"
|
||||
@ -4086,9 +4088,7 @@
|
||||
"// Change these values to test",
|
||||
"isLess(10, 15);"
|
||||
],
|
||||
"tail": [
|
||||
""
|
||||
],
|
||||
"tail": [],
|
||||
"solutions": [
|
||||
"function isLess(a, b) {\n return a < b;\n}"
|
||||
],
|
||||
@ -4142,9 +4142,7 @@
|
||||
"// Change values below to test your code",
|
||||
"abTest(2,2);"
|
||||
],
|
||||
"tail": [
|
||||
""
|
||||
],
|
||||
"tail": [],
|
||||
"solutions": [
|
||||
"function abTest(a, b) {\n if(a < 0 || b < 0) {\n return undefined;\n } \n return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));\n}"
|
||||
],
|
||||
@ -4756,9 +4754,7 @@
|
||||
"// Test your code by modifying these values",
|
||||
"checkObj(\"gift\");"
|
||||
],
|
||||
"tail": [
|
||||
""
|
||||
],
|
||||
"tail": [],
|
||||
"solutions": [
|
||||
"var myObj = {\n gift: \"pony\",\n pet: \"kitten\",\n bed: \"sleigh\"\n};\nfunction checkObj(checkProp) {\n if(myObj.hasOwnProperty(checkProp)) {\n return myObj[checkProp];\n } else {\n return \"Not Found\";\n }\n}"
|
||||
],
|
||||
@ -5379,9 +5375,7 @@
|
||||
"multiplyAll([[1,2],[3,4],[5,6,7]]);",
|
||||
""
|
||||
],
|
||||
"tail": [
|
||||
""
|
||||
],
|
||||
"tail": [],
|
||||
"solutions": [
|
||||
"function multiplyAll(arr) {\n var product = 1;\n for (var i = 0; i < arr.length; i++) {\n for (var j = 0; j < arr[i].length; j++) {\n product *= arr[i][j];\n }\n }\n return product;\n}\n\nmultiplyAll([[1,2],[3,4],[5,6,7]]);"
|
||||
],
|
||||
@ -5450,8 +5444,7 @@
|
||||
],
|
||||
"type": "waypoint",
|
||||
"challengeType": 1,
|
||||
"translations": {
|
||||
}
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "5688e62ea601b2482ff8422b",
|
||||
|
@ -84,7 +84,6 @@
|
||||
"This exercise is designed to illustrate the difference between how <code>var</code> and <code>let</code> keywords assign scope to the declared variable. When programming a function similar to the one used in this exercise, it is often better to use different variable names to avoid confusion."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"",
|
||||
"function checkScope() {",
|
||||
"\"use strict\";",
|
||||
" var i = \"function scope\";",
|
||||
|
@ -13,7 +13,8 @@
|
||||
"",
|
||||
"Functional programming is an approach to software development based around the evaluation of functions. Like mathematics, functions in programming map input to output to produce a result. You can combine basic functions in many ways to build more and more complex programs.<br><br>Functional programming follows a few core principles:<br><br><ul><li>Functions are independent from the state of the program or global variables. They only depend on the arguments passed into them to make a calculation</li><br><li>Functions try to limit any changes to the state of the program and avoid changes to the global objects holding data</li><br><li>Functions have minimal side effects in the program</li></ul><br><br>The functional programming software development approach breaks a program into small, testable parts. This section covers basic functional programming principles in JavaScript.",
|
||||
""
|
||||
] ],
|
||||
]
|
||||
],
|
||||
"releasedOn": "",
|
||||
"challengeSeed": [],
|
||||
"tests": [],
|
||||
|
@ -168,9 +168,7 @@
|
||||
"// Change the inputs below to test",
|
||||
"rot13(\"SERR PBQR PNZC\");"
|
||||
],
|
||||
"tail": [
|
||||
""
|
||||
],
|
||||
"tail": [],
|
||||
"solutions": [
|
||||
"var lookup = {\n 'A': 'N','B': 'O','C': 'P','D': 'Q',\n 'E': 'R','F': 'S','G': 'T','H': 'U',\n 'I': 'V','J': 'W','K': 'X','L': 'Y',\n 'M': 'Z','N': 'A','O': 'B','P': 'C',\n 'Q': 'D','R': 'E','S': 'F','T': 'G',\n 'U': 'H','V': 'I','W': 'J','X': 'K',\n 'Y': 'L','Z': 'M' \n};\n\nfunction rot13(encodedStr) {\n var codeArr = encodedStr.split(\"\"); // String to Array\n var decodedArr = []; // Your Result goes here\n // Only change code below this line\n \n decodedArr = codeArr.map(function(letter) {\n if(lookup.hasOwnProperty(letter)) {\n letter = lookup[letter];\n }\n return letter;\n });\n\n // Only change code above this line\n return decodedArr.join(\"\"); // Array to String\n}"
|
||||
],
|
||||
|
@ -136,7 +136,6 @@
|
||||
"Modify the <code>dog.sayLegs</code> method to remove any references to <code>dog</code>. Use the <code>duck</code> example for guidance."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"",
|
||||
"let dog = {",
|
||||
" name: \"Spot\",",
|
||||
" numLegs: 4,",
|
||||
@ -171,11 +170,7 @@
|
||||
"<hr>",
|
||||
"Create a <code>constructor</code>, <code>Dog</code>, with properties <code>name</code>, <code>color</code>, and <code>numLegs</code> that are set to a string, a string, and a number, respectively."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"challengeSeed": [],
|
||||
"tests": [
|
||||
"assert(typeof (new Dog()).name === 'string', 'message: <code>Dog</code> should have a <code>name</code> property set to a string.');",
|
||||
"assert(typeof (new Dog()).color === 'string', 'message: <code>Dog</code> should have a <code>color</code> property set to a string.');",
|
||||
|
@ -1894,11 +1894,7 @@
|
||||
"To start with, create an <code>h3</code> element, with the text <code>jQuery Playground</code>.",
|
||||
"Color your <code>h3</code> element with the <code>text-primary</code> Bootstrap class, and center it with the <code>text-center</code> Bootstrap class."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"challengeSeed": [],
|
||||
"tests": [
|
||||
"assert($(\"h3\") && $(\"h3\").length > 0, 'message: Add a <code>h3</code> element to your page.');",
|
||||
"assert(code.match(/<\\/h3>/g) && code.match(/<h3/g) && code.match(/<\\/h3>/g).length === code.match(/<h3/g).length, 'message: Make sure your <code>h3</code> element has a closing tag.');",
|
||||
|
@ -47,8 +47,6 @@
|
||||
"This is important because without your <code>document ready function</code>, your code may run before your HTML is rendered, which would cause bugs."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"",
|
||||
"",
|
||||
"<!-- Only change code above this line. -->",
|
||||
"",
|
||||
"<div class=\"container-fluid\">",
|
||||
|
@ -1,5 +1,4 @@
|
||||
{
|
||||
|
||||
"name": "React",
|
||||
"order": 5,
|
||||
"time": "5 hours",
|
||||
@ -292,7 +291,8 @@
|
||||
" // change code above this line",
|
||||
"}"
|
||||
],
|
||||
"tail": "ReactDOM.render(<MyComponent />, document.getElementById('root'))" }
|
||||
"tail": "ReactDOM.render(<MyComponent />, document.getElementById('root'))"
|
||||
}
|
||||
},
|
||||
"tests": [
|
||||
"assert((function() { const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); return mockedComponent.length === 1; })(), 'message: <code>MyComponent</code> should return JSX.');",
|
||||
@ -300,7 +300,7 @@
|
||||
"assert((function() { const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); return mockedComponent.find('div').text() !== ''; })(), 'message: The <code>div</code> element should contain a string of text.');"
|
||||
],
|
||||
"solutions": [
|
||||
"\nconst MyComponent = function() {\n // change code below this line\n return (\n <div>\n Demo Solution\n </div>\n );\n // change code above this line\n}"
|
||||
"const MyComponent = function() {\n // change code below this line\n return (\n <div>\n Demo Solution\n </div>\n );\n // change code above this line\n}"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -348,7 +348,7 @@
|
||||
"assert(Enzyme.shallow(React.createElement(MyComponent)).html() === '<div><h1>Hello React!</h1></div>', 'message: The <code>h1</code> header should contain the string <code>Hello React!</code>.');"
|
||||
],
|
||||
"solutions": [
|
||||
"\nclass MyComponent extends React.Component {\n constructor(props) {\n super(props);\n }\n render() {\n // change code below this line\n return (\n <div>\n <h1>Hello React!</h1>\n </div>\n );\n // change code above this line\n }\n};"
|
||||
"class MyComponent extends React.Component {\n constructor(props) {\n super(props);\n }\n render() {\n // change code below this line\n return (\n <div>\n <h1>Hello React!</h1>\n </div>\n );\n // change code above this line\n }\n};"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -684,7 +684,7 @@
|
||||
"assert((function() { const html = document.getElementById('challenge-node').childNodes[0].innerHTML; return (html === '<h1>Types of Food:</h1><div><h2>Fruits:</h2><h4>Non-Citrus:</h4><ul><li>Apples</li><li>Blueberries</li><li>Strawberries</li><li>Bananas</li></ul><h4>Citrus:</h4><ul><li>Lemon</li><li>Lime</li><li>Orange</li><li>Grapefruit</li></ul></div><div><h2>Vegetables:</h2><ul><li>Brussel Sprouts</li><li>Broccoli</li><li>Squash</li></ul></div>'); })(), 'message: The <code>TypesOfFood</code> component should render to the DOM within the <code>div</code> with the id <code>challenge-node</code>.');"
|
||||
],
|
||||
"solutions": [
|
||||
"\nclass TypesOfFood extends React.Component {\n constructor(props) {\n super(props);\n }\n render() {\n return (\n <div>\n <h1>Types of Food:</h1>\n {/* change code below this line */}\n <Fruits />\n <Vegetables />\n {/* change code above this line */}\n </div>\n );\n }\n};\n\n// change code below this line\nReactDOM.render(<TypesOfFood />, document.getElementById('challenge-node'));"
|
||||
"class TypesOfFood extends React.Component {\n constructor(props) {\n super(props);\n }\n render() {\n return (\n <div>\n <h1>Types of Food:</h1>\n {/* change code below this line */}\n <Fruits />\n <Vegetables />\n {/* change code above this line */}\n </div>\n );\n }\n};\n\n// change code below this line\nReactDOM.render(<TypesOfFood />, document.getElementById('challenge-node'));"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -782,7 +782,7 @@
|
||||
"assert((function() { const mockedComponent = Enzyme.mount(React.createElement(Calendar)); return mockedComponent.find('p').html().includes(Date().substr(3)); })(), 'message: The <code>CurrentDate</code> component should render the value from the <code>date</code> prop in the <code>p</code> tag.');"
|
||||
],
|
||||
"solutions": [
|
||||
"\nconst CurrentDate = (props) => {\n return (\n <div>\n { /* change code below this line */ }\n <p>The current date is: {props.date}</p>\n { /* change code above this line */ }\n </div>\n );\n};\n\nclass Calendar extends React.Component {\n constructor(props) {\n super(props);\n }\n render() {\n return (\n <div>\n <h3>What date is it?</h3>\n { /* change code below this line */ }\n <CurrentDate date={Date()} />\n { /* change code above this line */ }\n </div>\n );\n }\n};"
|
||||
"const CurrentDate = (props) => {\n return (\n <div>\n { /* change code below this line */ }\n <p>The current date is: {props.date}</p>\n { /* change code above this line */ }\n </div>\n );\n};\n\nclass Calendar extends React.Component {\n constructor(props) {\n super(props);\n }\n render() {\n return (\n <div>\n <h3>What date is it?</h3>\n { /* change code below this line */ }\n <CurrentDate date={Date()} />\n { /* change code above this line */ }\n </div>\n );\n }\n};"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -1177,7 +1177,7 @@
|
||||
"assert((function() { const mockedComponent = Enzyme.mount(React.createElement(StatefulComponent)); const initialState = mockedComponent.state(); return mockedComponent.find('h1').text() === initialState.name; })(), 'message: The property <code>name</code> in the state of <code>StatefulComponent</code> should render in the <code>h1</code> element.');"
|
||||
],
|
||||
"solutions": [
|
||||
"\nclass StatefulComponent extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n name: 'freeCodeCamp!'\n }\n }\n render() {\n return (\n <div>\n <h1>{this.state.name}</h1>\n </div>\n );\n }\n};"
|
||||
"class StatefulComponent extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n name: 'freeCodeCamp!'\n }\n }\n render() {\n return (\n <div>\n <h1>{this.state.name}</h1>\n </div>\n );\n }\n};"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -2058,7 +2058,7 @@
|
||||
"tests": [
|
||||
"assert((function() { const mockedComponent = Enzyme.mount(React.createElement(Controller)); return mockedComponent.find('Controller').length === 1 && mockedComponent.find('Dialog').length === 1; })(), 'message: The <code>Controller</code> component should render the <code>Dialog</code> component as a child.');",
|
||||
"assert((function() { const lifecycleChild = React.createElement(Dialog).type.prototype.componentWillReceiveProps.toString().replace(/ /g,''); return lifecycleChild.includes('console.log') && lifecycleChild.includes('this.props') })(), 'message: The <code>componentWillReceiveProps</code> method in the <code>Dialog</code> component should log <code>this.props</code> to the console.');",
|
||||
"assert((function() { const lifecycleChild = React.createElement(Dialog).type.prototype.componentWillReceiveProps.toString().replace(/ /g,''); const nextPropsAsParameterTest = \/componentWillReceiveProps(| *?= *?)(\\(|)nextProps(\\)|)( *?=> *?{| *?{|{)\/; const nextPropsInConsoleLogTest = \/console\\.log\\(.*?nextProps\\b.*?\\)\/; return ( lifecycleChild.includes('console.log') && nextPropsInConsoleLogTest.test(lifecycleChild) && nextPropsAsParameterTest.test(lifecycleChild) ); })(), 'message: The <code>componentWillReceiveProps</code> method in the <code>Dialog</code> component should log <code>nextProps</code> to the console.');",
|
||||
"assert((function() { const lifecycleChild = React.createElement(Dialog).type.prototype.componentWillReceiveProps.toString().replace(/ /g,''); const nextPropsAsParameterTest = /componentWillReceiveProps(| *?= *?)(\\(|)nextProps(\\)|)( *?=> *?{| *?{|{)/; const nextPropsInConsoleLogTest = /console\\.log\\(.*?nextProps\\b.*?\\)/; return ( lifecycleChild.includes('console.log') && nextPropsInConsoleLogTest.test(lifecycleChild) && nextPropsAsParameterTest.test(lifecycleChild) ); })(), 'message: The <code>componentWillReceiveProps</code> method in the <code>Dialog</code> component should log <code>nextProps</code> to the console.');",
|
||||
"assert((function() { const lifecycleChild = React.createElement(Dialog).type.prototype.componentDidUpdate.toString().replace(/ /g,''); return lifecycleChild.length !== 'undefined' && lifecycleChild.includes('console.log'); })(), 'message: The <code>Dialog</code> component should call the <code>componentDidUpdate</code> method and log a message to the console.');"
|
||||
],
|
||||
"solutions": [
|
||||
@ -2186,7 +2186,7 @@
|
||||
"assert((function() { const mockedComponent = Enzyme.mount(React.createElement(Colorful)); return (mockedComponent.children().props().style.fontSize === 72 || mockedComponent.children().props().style.fontSize === '72' || mockedComponent.children().props().style.fontSize === '72px'); })(), 'message: The <code>div</code> element should have a font size of <code>72px</code>.');"
|
||||
],
|
||||
"solutions": [
|
||||
"\nclass Colorful extends React.Component {\n render() {\n return (\n <div style={{color: \"red\", fontSize: 72}}>Big Red</div>\n );\n }\n};\n"
|
||||
"class Colorful extends React.Component {\n render() {\n return (\n <div style={{color: \"red\", fontSize: 72}}>Big Red</div>\n );\n }\n};\n"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -2235,7 +2235,7 @@
|
||||
"assert((function() { const mockedComponent = Enzyme.shallow(React.createElement(Colorful)); return (mockedComponent.props().style.color === \"purple\" && mockedComponent.props().style.fontSize === 40 && mockedComponent.props().style.border === \"2px solid purple\"); })(), 'message: The <code>div</code> element should have its styles defined by the <code>styles</code> object.');"
|
||||
],
|
||||
"solutions": [
|
||||
"\nconst styles = {\n color: \"purple\",\n fontSize: 40,\n border: \"2px solid purple\"\n};\n// change code above this line\nclass Colorful extends React.Component {\n render() {\n // change code below this line\n return (\n <div style={styles}>Style Me!</div>\n // change code above this line\n );\n }\n};\n"
|
||||
"const styles = {\n color: \"purple\",\n fontSize: 40,\n border: \"2px solid purple\"\n};\n// change code above this line\nclass Colorful extends React.Component {\n render() {\n // change code below this line\n return (\n <div style={styles}>Style Me!</div>\n // change code above this line\n );\n }\n};\n"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -2346,7 +2346,7 @@
|
||||
"async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const comp = Enzyme.mount(React.createElement(MagicEightBall)); const simulate = () => { comp.find('input').simulate('change', { target: { value: 'test?' }}); comp.find('button').simulate('click'); }; const result = () => comp.find('p').text(); const _1 = () => { simulate(); return waitForIt(() => result()) }; const _2 = () => { simulate(); return waitForIt(() => result()) }; const _3 = () => { simulate(); return waitForIt(() => result()) }; const _4 = () => { simulate(); return waitForIt(() => result()) }; const _5 = () => { simulate(); return waitForIt(() => result()) }; const _6 = () => { simulate(); return waitForIt(() => result()) }; const _7 = () => { simulate(); return waitForIt(() => result()) }; const _8 = () => { simulate(); return waitForIt(() => result()) }; const _9 = () => { simulate(); return waitForIt(() => result()) }; const _10 = () => { simulate(); return waitForIt(() => result()) }; const _1_val = await _1(); const _2_val = await _2(); const _3_val = await _3(); const _4_val = await _4(); const _5_val = await _5(); const _6_val = await _6(); const _7_val = await _7(); const _8_val = await _8(); const _9_val = await _9(); const _10_val = await _10(); const actualAnswers = [_1_val, _2_val, _3_val, _4_val, _5_val, _6_val, _7_val, _8_val, _9_val, _10_val]; const hasIndex = actualAnswers.filter((answer, i) => possibleAnswers.indexOf(answer) !== -1); const notAllEqual = new Set(actualAnswers); assert(notAllEqual.size > 1 && hasIndex.length === 10, 'message: When text is entered into the <code>input</code> element and the button is clicked, the <code>MagicEightBall</code> component should return a <code>p</code> element that contains a random element from the <code>possibleAnswers</code> array.');}"
|
||||
],
|
||||
"solutions": [
|
||||
"\nconst inputStyle = {\n width: 235,\n margin: 5\n}\n\nclass MagicEightBall extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n userInput: '',\n randomIndex: ''\n }\n this.ask = this.ask.bind(this);\n this.handleChange = this.handleChange.bind(this);\n }\n ask() {\n if (this.state.userInput) {\n this.setState({\n randomIndex: Math.floor(Math.random() * 20),\n userInput: ''\n });\n }\n }\n handleChange(event) {\n this.setState({\n userInput: event.target.value\n });\n }\n render() {\n const possibleAnswers = [\n \"It is certain\", \"It is decidedly so\", \"Without a doubt\",\n \"Yes, definitely\", \"You may rely on it\", \"As I see it, yes\",\n \"Outlook good\", \"Yes\", \"Signs point to yes\", \"Reply hazy try again\",\n \"Ask again later\", \"Better not tell you now\", \"Cannot predict now\",\n \"Concentrate and ask again\", \"Don't count on it\", \"My reply is no\",\n \"My sources say no\", \"Outlook not so good\",\"Very doubtful\", \"Most likely\"\n ];\n const answer = possibleAnswers[this.state.randomIndex];\n return (\n <div>\n <input\n type=\"text\"\n value={this.state.userInput}\n onChange={this.handleChange}\n style={inputStyle} /><br />\n <button onClick={this.ask}>Ask the Magic Eight Ball!</button><br />\n <h3>Answer:</h3>\n <p>\n {answer}\n </p>\n </div>\n );\n }\n};"
|
||||
"const inputStyle = {\n width: 235,\n margin: 5\n}\n\nclass MagicEightBall extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n userInput: '',\n randomIndex: ''\n }\n this.ask = this.ask.bind(this);\n this.handleChange = this.handleChange.bind(this);\n }\n ask() {\n if (this.state.userInput) {\n this.setState({\n randomIndex: Math.floor(Math.random() * 20),\n userInput: ''\n });\n }\n }\n handleChange(event) {\n this.setState({\n userInput: event.target.value\n });\n }\n render() {\n const possibleAnswers = [\n \"It is certain\", \"It is decidedly so\", \"Without a doubt\",\n \"Yes, definitely\", \"You may rely on it\", \"As I see it, yes\",\n \"Outlook good\", \"Yes\", \"Signs point to yes\", \"Reply hazy try again\",\n \"Ask again later\", \"Better not tell you now\", \"Cannot predict now\",\n \"Concentrate and ask again\", \"Don't count on it\", \"My reply is no\",\n \"My sources say no\", \"Outlook not so good\",\"Very doubtful\", \"Most likely\"\n ];\n const answer = possibleAnswers[this.state.randomIndex];\n return (\n <div>\n <input\n type=\"text\"\n value={this.state.userInput}\n onChange={this.handleChange}\n style={inputStyle} /><br />\n <button onClick={this.ask}>Ask the Magic Eight Ball!</button><br />\n <h3>Answer:</h3>\n <p>\n {answer}\n </p>\n </div>\n );\n }\n};"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -2545,7 +2545,7 @@
|
||||
"assert(new RegExp(/(\\s|;)if(\\s|\\()/).test(Enzyme.mount(React.createElement(CheckUserAge)).instance().render.toString()) === false, 'message: Your code should not contain any <code>if/else</code> statements.');"
|
||||
],
|
||||
"solutions": [
|
||||
"\nconst inputStyle = {\n width: 235,\n margin: 5\n}\n\nclass CheckUserAge extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n userAge: '',\n input: ''\n }\n this.submit = this.submit.bind(this);\n this.handleChange = this.handleChange.bind(this);\n }\n handleChange(e) {\n this.setState({\n input: e.target.value,\n userAge: ''\n });\n }\n submit() {\n this.setState({\n userAge: this.state.input\n });\n }\n render() {\n const buttonOne = <button onClick={this.submit}>Submit</button>;\n const buttonTwo = <button>You May Enter</button>;\n const buttonThree = <button>You Shall Not Pass</button>;\n return (\n <div>\n <h3>Enter Your Age to Continue</h3>\n <input\n style={inputStyle}\n type=\"number\"\n value={this.state.input}\n onChange={this.handleChange} /><br />\n {\n this.state.userAge === '' ?\n buttonOne :\n this.state.userAge >= 18 ?\n buttonTwo :\n buttonThree\n }\n </div>\n );\n }\n};"
|
||||
"const inputStyle = {\n width: 235,\n margin: 5\n}\n\nclass CheckUserAge extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n userAge: '',\n input: ''\n }\n this.submit = this.submit.bind(this);\n this.handleChange = this.handleChange.bind(this);\n }\n handleChange(e) {\n this.setState({\n input: e.target.value,\n userAge: ''\n });\n }\n submit() {\n this.setState({\n userAge: this.state.input\n });\n }\n render() {\n const buttonOne = <button onClick={this.submit}>Submit</button>;\n const buttonTwo = <button>You May Enter</button>;\n const buttonThree = <button>You Shall Not Pass</button>;\n return (\n <div>\n <h3>Enter Your Age to Continue</h3>\n <input\n style={inputStyle}\n type=\"number\"\n value={this.state.input}\n onChange={this.handleChange} /><br />\n {\n this.state.userAge === '' ?\n buttonOne :\n this.state.userAge >= 18 ?\n buttonTwo :\n buttonThree\n }\n </div>\n );\n }\n};"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -2691,7 +2691,7 @@
|
||||
"async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 100)); const mockedComponent = Enzyme.mount(React.createElement(GateKeeper)); const simulateChange = (el, value) => el.simulate('change', {target: {value}}); let initialStyle = mockedComponent.find('input').props().style.border; const state_1 = () => { mockedComponent.setState({input: 'this is 15 char' }); return waitForIt(() => mockedComponent.find('input').props().style.border )}; const state_2 = () => { mockedComponent.setState({input: 'A very long string longer than 15 characters.' }); return waitForIt(() => mockedComponent.find('input').props().style.border )}; const style_1 = await state_1(); const style_2 = await state_2(); assert(initialStyle === '1px solid black' && style_1 === '1px solid black' && style_2 === '3px solid red', 'message: The <code>input</code> tag should be styled with a border of <code>3px solid red</code> if the input value in state is longer than 15 characters.'); }; "
|
||||
],
|
||||
"solutions": [
|
||||
"\nclass GateKeeper extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n input: ''\n };\n this.handleChange = this.handleChange.bind(this);\n }\n handleChange(event) {\n this.setState({ input: event.target.value })\n }\n render() {\n let inputStyle = {\n border: '1px solid black'\n };\n if (this.state.input.length > 15) {\n inputStyle.border = '3px solid red';\n };\n return (\n <div>\n <h3>Don't Type Too Much:</h3>\n <input\n type=\"text\"\n style={inputStyle}\n value={this.state.input}\n onChange={this.handleChange} />\n </div>\n );\n }\n};"
|
||||
"class GateKeeper extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n input: ''\n };\n this.handleChange = this.handleChange.bind(this);\n }\n handleChange(event) {\n this.setState({ input: event.target.value })\n }\n render() {\n let inputStyle = {\n border: '1px solid black'\n };\n if (this.state.input.length > 15) {\n inputStyle.border = '3px solid red';\n };\n return (\n <div>\n <h3>Don't Type Too Much:</h3>\n <input\n type=\"text\"\n style={inputStyle}\n value={this.state.input}\n onChange={this.handleChange} />\n </div>\n );\n }\n};"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -2772,7 +2772,7 @@
|
||||
"async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 100)); const mockedComponent = Enzyme.mount(React.createElement(MyToDoList)); const simulateChange = (el, value) => el.simulate('change', {target: {value}}); const state_1 = () => { return waitForIt(() => mockedComponent.find('ul').find('li'))}; const setInput = () => { return waitForIt(() => simulateChange(mockedComponent.find('textarea'), \"testA, testB, testC\"))}; const click = () => { return waitForIt(() => mockedComponent.find('button').simulate('click'))}; const state_2 = () => { return waitForIt(() => { const nodes = mockedComponent.find('ul').find('li'); return { nodes, text: nodes.reduce((t, n) => t + n.text(), '') }; })}; const setInput_2 = () => { return waitForIt(() => simulateChange(mockedComponent.find('textarea'), \"t1, t2, t3, t4, t5, t6\"))}; const click_1 = () => { return waitForIt(() => mockedComponent.find('button').simulate('click'))}; const state_3 = () => { return waitForIt(() => { const nodes = mockedComponent.find('ul').find('li'); return { nodes, text: nodes.reduce((t, n) => t + n.text(), '') }; })}; const awaited_state_1 = await state_1(); const awaited_setInput = await setInput(); const awaited_click = await click(); const awaited_state_2 = await state_2(); const awaited_setInput_2 = await setInput_2(); const awaited_click_1 = await click_1(); const awaited_state_3 = await state_3(); assert(awaited_state_1.length === 0 && awaited_state_2.nodes.length === 3 && awaited_state_3.nodes.length === 6 && awaited_state_2.text === 'testA testB testC' && awaited_state_3.text === 't1 t2 t3 t4 t5 t6', 'message: When the <code>Create List</code> button is clicked, the <code>MyToDoList</code> component should dynamically return an unordered list that contains a list item element for every item of a comma-separated list entered into the <code>textarea</code> element.'); }; "
|
||||
],
|
||||
"solutions": [
|
||||
"\nconst textAreaStyles = {\n width: 235,\n margin: 5\n};\n\nclass MyToDoList extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n toDoList: [],\n userInput: ''\n }\n this.handleSubmit = this.handleSubmit.bind(this);\n this.handleChange = this.handleChange.bind(this);\n }\n handleSubmit() {\n const itemsArray = this.state.userInput.split(',');\n this.setState({\n toDoList: itemsArray\n });\n }\n handleChange(e) {\n this.setState({\n userInput: e.target.value\n });\n }\n render() {\n const items = this.state.toDoList.map( (item, i) => {\n return <li key={i}>{item}</li>\n });\n return (\n <div>\n <textarea\n onChange={this.handleChange}\n value={this.state.userInput}\n style={textAreaStyles}\n placeholder=\"Separate Items With Commas\" /><br />\n <button onClick={this.handleSubmit}>Create List</button>\n <h1>My \"To Do\" List:</h1>\n <ul>\n {items}\n </ul>\n </div>\n );\n }\n};"
|
||||
"const textAreaStyles = {\n width: 235,\n margin: 5\n};\n\nclass MyToDoList extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n toDoList: [],\n userInput: ''\n }\n this.handleSubmit = this.handleSubmit.bind(this);\n this.handleChange = this.handleChange.bind(this);\n }\n handleSubmit() {\n const itemsArray = this.state.userInput.split(',');\n this.setState({\n toDoList: itemsArray\n });\n }\n handleChange(e) {\n this.setState({\n userInput: e.target.value\n });\n }\n render() {\n const items = this.state.toDoList.map( (item, i) => {\n return <li key={i}>{item}</li>\n });\n return (\n <div>\n <textarea\n onChange={this.handleChange}\n value={this.state.userInput}\n style={textAreaStyles}\n placeholder=\"Separate Items With Commas\" /><br />\n <button onClick={this.handleSubmit}>Create List</button>\n <h1>My \"To Do\" List:</h1>\n <ul>\n {items}\n </ul>\n </div>\n );\n }\n};"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -2828,7 +2828,7 @@
|
||||
"assert((() => { const ul = Enzyme.mount(React.createElement(Frameworks)).find('ul'); const keys = new Set([ ul.childAt(0).key(), ul.childAt(1).key(), ul.childAt(2).key(), ul.childAt(3).key(), ul.childAt(4).key(), ul.childAt(5).key(), ]); return keys.size === 6; })(), 'message: Each list item element should have a unique <code>key</code> attribute.');"
|
||||
],
|
||||
"solutions": [
|
||||
"\nconst frontEndFrameworks = [\n 'React',\n 'Angular',\n 'Ember',\n 'Knockout',\n 'Backbone',\n 'Vue'\n];\n\nfunction Frameworks() {\n const renderFrameworks = frontEndFrameworks.map((fw, i) => {\n return <li key={i}>{fw}</li>\n })\n return (\n <div>\n <h1>Popular Front End JavaScript Frameworks</h1>\n <ul>\n {renderFrameworks}\n </ul>\n </div>\n );\n};"
|
||||
"const frontEndFrameworks = [\n 'React',\n 'Angular',\n 'Ember',\n 'Knockout',\n 'Backbone',\n 'Vue'\n];\n\nfunction Frameworks() {\n const renderFrameworks = frontEndFrameworks.map((fw, i) => {\n return <li key={i}>{fw}</li>\n })\n return (\n <div>\n <h1>Popular Front End JavaScript Frameworks</h1>\n <ul>\n {renderFrameworks}\n </ul>\n </div>\n );\n};"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -2908,7 +2908,7 @@
|
||||
"assert((() => { const ul = Enzyme.mount(React.createElement(MyComponent)).find('ul'); console.log(ul.debug()); const keys = new Set([ ul.childAt(0).key(), ul.childAt(1).key(), ul.childAt(2).key(), ul.childAt(3).key() ]); return keys.size === 4; })(), 'message: Each list item element should have a unique <code>key</code> attribute.');"
|
||||
],
|
||||
"solutions": [
|
||||
"\nclass MyComponent extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n users: [\n {\n username: 'Jeff',\n online: true\n },\n {\n username: 'Alan',\n online: false\n },\n {\n username: 'Mary',\n online: true\n },\n {\n username: 'Jim',\n online: false\n },\n {\n username: 'Sara',\n online: true\n },\n {\n username: 'Laura',\n online: true\n }\n ]\n }\n }\n render() {\n const usersOnline = this.state.users.filter(user => {\n return user.online;\n });\n const renderOnlineUsers = usersOnline.map(user => {\n return (\n <li key={user.username}>{user.username}</li>\n );\n });\n return (\n <div>\n <h1>Current Online Users:</h1>\n <ul>\n {renderOnlineUsers}\n </ul>\n </div>\n );\n }\n};"
|
||||
"class MyComponent extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n users: [\n {\n username: 'Jeff',\n online: true\n },\n {\n username: 'Alan',\n online: false\n },\n {\n username: 'Mary',\n online: true\n },\n {\n username: 'Jim',\n online: false\n },\n {\n username: 'Sara',\n online: true\n },\n {\n username: 'Laura',\n online: true\n }\n ]\n }\n }\n render() {\n const usersOnline = this.state.users.filter(user => {\n return user.online;\n });\n const renderOnlineUsers = usersOnline.map(user => {\n return (\n <li key={user.username}>{user.username}</li>\n );\n });\n return (\n <div>\n <h1>Current Online Users:</h1>\n <ul>\n {renderOnlineUsers}\n </ul>\n </div>\n );\n }\n};"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
@ -2954,7 +2954,7 @@
|
||||
"getUserInput => assert(getUserInput('index').replace(/ /g,'').includes('ReactDOMServer.renderToString(<App/>)') && Enzyme.mount(React.createElement(App)).children().name() === 'div', 'message: The <code>App</code> component should render to a string using <code>ReactDOMServer.renderToString</code>.');"
|
||||
],
|
||||
"solutions": [
|
||||
"\nclass App extends React.Component {\n constructor(props) {\n super(props);\n }\n render() {\n return <div/>\n }\n};\n\n// change code below this line\nReactDOMServer.renderToString(<App/>);"
|
||||
"class App extends React.Component {\n constructor(props) {\n super(props);\n }\n render() {\n return <div/>\n }\n};\n\n// change code below this line\nReactDOMServer.renderToString(<App/>);"
|
||||
],
|
||||
"challengeType": 6,
|
||||
"isRequired": false,
|
||||
|
@ -15,7 +15,9 @@
|
||||
"assert.strictEqual(multiplesOf3and5(19564), 89301183, 'message: <code>multiplesOf3and5(19564)</code> should return 89301183.');",
|
||||
"assert.strictEqual(multiplesOf3and5(8456), 16687353, 'message: Your function is not returning the correct result using our tests values.');"
|
||||
],
|
||||
"solutions": ["const multiplesOf3and5 = (number) => {\n var total = 0;\n\n for(var i = 0; i < number; i++) {\n if(i % 3 == 0 || i % 5 == 0) {\n total += i;\n }\n }\n return total;\n};"],
|
||||
"solutions": [
|
||||
"const multiplesOf3and5 = (number) => {\n var total = 0;\n\n for(var i = 0; i < number; i++) {\n if(i % 3 == 0 || i % 5 == 0) {\n total += i;\n }\n }\n return total;\n};"
|
||||
],
|
||||
"translations": {},
|
||||
"challengeSeed": [
|
||||
"function multiplesOf3and5(number) {",
|
||||
@ -42,7 +44,9 @@
|
||||
"assert.strictEqual(fiboEvenSum(18), 3382, 'message: Your function is not returning the correct result using our tests values.');",
|
||||
"assert.equal(fiboEvenSum(31) % 2 === 0, true, 'message: Your function should return an <code>even</code> value.');"
|
||||
],
|
||||
"solutions": ["const fiboEvenSum = (number) => {\n let temp, sum = 0, a = 0, b = 1;\n while (number >= 0) {\n temp = a;\n a = b;\n b += temp;\n number --;\n if ((b % 2) === 0) {\n sum += b;\n }\n }\n\n return sum;\n}"],
|
||||
"solutions": [
|
||||
"const fiboEvenSum = (number) => {\n let temp, sum = 0, a = 0, b = 1;\n while (number >= 0) {\n temp = a;\n a = b;\n b += temp;\n number --;\n if ((b % 2) === 0) {\n sum += b;\n }\n }\n\n return sum;\n}"
|
||||
],
|
||||
"translations": {},
|
||||
"challengeSeed": [
|
||||
"function fiboEvenSum(number) {",
|
||||
@ -124,7 +128,9 @@
|
||||
"assert.strictEqual(smallestMult(10), 2520, 'message: <code>smallestMult(10)</code> should return 2520.');",
|
||||
"assert.strictEqual(smallestMult(20), 232792560, 'message: <code>smallestMult(20)</code> should return 232792560.');"
|
||||
],
|
||||
"solutions": ["function smallestMult(n){\n function gcd(a, b) {\n return b === 0 ? a : gcd(b, a%b); // Euclidean algorithm\n }\n\n function lcm(a, b) {\n return a * b / gcd(a, b);\n }\n var result = 1;\n for(var i = 2; i <= n; i++) {\n result = lcm(result, i);\n }\n return result;\n}"],
|
||||
"solutions": [
|
||||
"function smallestMult(n){\n function gcd(a, b) {\n return b === 0 ? a : gcd(b, a%b); // Euclidean algorithm\n }\n\n function lcm(a, b) {\n return a * b / gcd(a, b);\n }\n var result = 1;\n for(var i = 2; i <= n; i++) {\n result = lcm(result, i);\n }\n return result;\n}"
|
||||
],
|
||||
"translations": {},
|
||||
"challengeSeed": [
|
||||
"function smallestMult(n) {",
|
||||
@ -263,8 +269,10 @@
|
||||
"translations": {},
|
||||
"challengeSeed": [
|
||||
"function specialPythagoreanTriplet(n) {",
|
||||
" let sumOfabc = n;", " // Good luck!",
|
||||
" return true;", "}",
|
||||
" let sumOfabc = n;",
|
||||
" // Good luck!",
|
||||
" return true;",
|
||||
"}",
|
||||
"",
|
||||
"specialPythagoreanTriplet(1000);"
|
||||
],
|
||||
@ -286,7 +294,9 @@
|
||||
"assert.strictEqual(primeSummation(140759), 873608362, 'message: <code>primeSummation(140759)</code> should return 873608362.');",
|
||||
"assert.strictEqual(primeSummation(2000000), 142913828922, 'message: <code>primeSummation(2000000)</code> should return 142913828922.');"
|
||||
],
|
||||
"solutions": ["//noprotect\nfunction primeSummation(n) {\n // Initialise an array containing only prime numbers\n let primes = [2];\n let result = 2;\n\n function isPrime(y, primes) {\n // Find sqrt(y)\n const sqrt = Math.floor(Math.sqrt(y));\n\n // Divide y by each applicable prime, return false if any of them divide y\n for (let i = 0; i < primes.length && primes[i] <= sqrt; i++) {\n if (y % primes[i] === 0) {\n return false;\n }\n }\n\n // At this point x must be prime\n return true;\n }\n\n // For every odd integer, add it to the array if it is prime\n for (let x = 3; x < n; x += 2) {\n if (isPrime(x, primes)) {\n if (x > n) {\n return result;\n } else {\n result += x;\n primes.push(x);\n }\n }\n }\n\n return result;\n}"],
|
||||
"solutions": [
|
||||
"//noprotect\nfunction primeSummation(n) {\n // Initialise an array containing only prime numbers\n let primes = [2];\n let result = 2;\n\n function isPrime(y, primes) {\n // Find sqrt(y)\n const sqrt = Math.floor(Math.sqrt(y));\n\n // Divide y by each applicable prime, return false if any of them divide y\n for (let i = 0; i < primes.length && primes[i] <= sqrt; i++) {\n if (y % primes[i] === 0) {\n return false;\n }\n }\n\n // At this point x must be prime\n return true;\n }\n\n // For every odd integer, add it to the array if it is prime\n for (let x = 3; x < n; x += 2) {\n if (isPrime(x, primes)) {\n if (x > n) {\n return result;\n } else {\n result += x;\n primes.push(x);\n }\n }\n }\n\n return result;\n}"
|
||||
],
|
||||
"translations": {},
|
||||
"challengeSeed": [
|
||||
"function primeSummation(n) {",
|
||||
@ -310,7 +320,9 @@
|
||||
"assert.strictEqual(largestGridProduct(grid), 70600674, 'message: <code>largestGridProduct(grid)</code> should return 70600674.');",
|
||||
"assert.strictEqual(largestGridProduct(testGrid), 14169081, 'message: <code>largestGridProduct(testGrid)</code> should return 14169081.');"
|
||||
],
|
||||
"solutions": ["function largestGridProduct(arr) {\n let maxProduct = 0;\n let currProduct = 0;\n\n function maxProductChecker(n) {\n if (n > maxProduct) {\n return maxProduct = n;\n }\n }\n\n // loop rows\n for (let r = 0; r < arr.length; r++) {\n // loop columns\n for (let c = 0; c < arr[r].length; c++) {\n const limit = arr[r].length - 3;\n\n // check horizontal\n if (c < limit) {\n currProduct = arr[r][c] * arr[r][c + 1] * arr[r][c + 2] * arr[r][c + 3];\n maxProductChecker(currProduct);\n }\n\n // check vertical\n if (r < limit) {\n currProduct = arr[r][c] * arr[r + 1][c] * arr[r + 2][c] * arr[r + 3][c];\n maxProductChecker(currProduct);\n }\n\n // check diagonal [\\]\n if (c < limit && r < limit) {\n currProduct = arr[r][c] * arr[r + 1][c + 1] * arr[r + 2][c + 2] * arr[r + 3][c + 3];\n maxProductChecker(currProduct);\n }\n\n // check diagonal [/]\n if (c > 3 && r < limit) {\n currProduct = arr[r][c] * arr[r + 1][c - 1] * arr[r + 2][c - 2] * arr[r + 3][c - 3];\n maxProductChecker(currProduct);\n }\n }\n }\n\n return maxProduct;\n}\n\n const grid = [ [8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8],\n [49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0],\n [81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65],\n [52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91],\n [22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80],\n [24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50],\n [32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70],\n [67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21],\n [24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72],\n [21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95],\n [78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92],\n [16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57],\n [86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58],\n [19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40],\n [4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66],\n [88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69],\n [4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36],\n [20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16],\n [20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54],\n [1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48]\n];\n\nconst testGrid = [\n [40, 17, 81, 18, 57],\n [74, 4, 36, 16, 29],\n [36, 42, 69, 73, 45],\n [51, 54, 69, 16, 92],\n [7, 97, 57, 32, 16]\n];"],
|
||||
"solutions": [
|
||||
"function largestGridProduct(arr) {\n let maxProduct = 0;\n let currProduct = 0;\n\n function maxProductChecker(n) {\n if (n > maxProduct) {\n return maxProduct = n;\n }\n }\n\n // loop rows\n for (let r = 0; r < arr.length; r++) {\n // loop columns\n for (let c = 0; c < arr[r].length; c++) {\n const limit = arr[r].length - 3;\n\n // check horizontal\n if (c < limit) {\n currProduct = arr[r][c] * arr[r][c + 1] * arr[r][c + 2] * arr[r][c + 3];\n maxProductChecker(currProduct);\n }\n\n // check vertical\n if (r < limit) {\n currProduct = arr[r][c] * arr[r + 1][c] * arr[r + 2][c] * arr[r + 3][c];\n maxProductChecker(currProduct);\n }\n\n // check diagonal [\\]\n if (c < limit && r < limit) {\n currProduct = arr[r][c] * arr[r + 1][c + 1] * arr[r + 2][c + 2] * arr[r + 3][c + 3];\n maxProductChecker(currProduct);\n }\n\n // check diagonal [/]\n if (c > 3 && r < limit) {\n currProduct = arr[r][c] * arr[r + 1][c - 1] * arr[r + 2][c - 2] * arr[r + 3][c - 3];\n maxProductChecker(currProduct);\n }\n }\n }\n\n return maxProduct;\n}\n\n const grid = [ [8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8],\n [49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0],\n [81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65],\n [52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91],\n [22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80],\n [24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50],\n [32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70],\n [67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21],\n [24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72],\n [21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95],\n [78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92],\n [16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57],\n [86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58],\n [19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40],\n [4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66],\n [88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69],\n [4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36],\n [20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16],\n [20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54],\n [1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48]\n];\n\nconst testGrid = [\n [40, 17, 81, 18, 57],\n [74, 4, 36, 16, 29],\n [36, 42, 69, 73, 45],\n [51, 54, 69, 16, 92],\n [7, 97, 57, 32, 16]\n];"
|
||||
],
|
||||
"translations": {},
|
||||
"challengeSeed": [
|
||||
"function largestGridProduct(arr) {",
|
||||
@ -389,7 +401,9 @@
|
||||
"assert.strictEqual(divisibleTriangleNumber(23), 630, 'message: <code>divisibleTriangleNumber(23)</code> should return 630.');",
|
||||
"assert.strictEqual(divisibleTriangleNumber(500), 76576500, 'message: <code>divisibleTriangleNumber()</code> should return 76576500.');"
|
||||
],
|
||||
"solutions": ["function divisibleTriangleNumber(n) {\n let counter = 1;\n let triangleNumber = counter++;\n\n function getFactors(num) {\n let factors = [];\n\n let possibleFactor = 1;\n let sqrt = Math.sqrt(num);\n\n while (possibleFactor <= sqrt) {\n if (num % possibleFactor == 0) {\n factors.push(possibleFactor);\n var otherPossibleFactor = num / possibleFactor;\n if (otherPossibleFactor > possibleFactor) {\n factors.push(otherPossibleFactor);\n }\n }\n possibleFactor++;\n }\n\n return factors;\n }\n\n while (getFactors(triangleNumber).length < n) {\n triangleNumber += counter++;\n }\n console.log(triangleNumber)\n return triangleNumber;\n}"],
|
||||
"solutions": [
|
||||
"function divisibleTriangleNumber(n) {\n let counter = 1;\n let triangleNumber = counter++;\n\n function getFactors(num) {\n let factors = [];\n\n let possibleFactor = 1;\n let sqrt = Math.sqrt(num);\n\n while (possibleFactor <= sqrt) {\n if (num % possibleFactor == 0) {\n factors.push(possibleFactor);\n var otherPossibleFactor = num / possibleFactor;\n if (otherPossibleFactor > possibleFactor) {\n factors.push(otherPossibleFactor);\n }\n }\n possibleFactor++;\n }\n\n return factors;\n }\n\n while (getFactors(triangleNumber).length < n) {\n triangleNumber += counter++;\n }\n console.log(triangleNumber)\n return triangleNumber;\n}"
|
||||
],
|
||||
"translations": {},
|
||||
"challengeSeed": [
|
||||
"function divisibleTriangleNumber(n) {",
|
||||
@ -423,7 +437,9 @@
|
||||
"assert.strictEqual(largeSum(testNums), 8348422521, 'message: <code>largeSum(testNums)</code> should return 8348422521.');",
|
||||
"assert.strictEqual(largeSum(fiftyDigitNums), 5537376230, 'message: <code>largeSum(fiftyDigitNums)</code> should return 5537376230.');"
|
||||
],
|
||||
"solutions": ["function largeSum(arr) {\n\n let sum = 0;\n\n arr.forEach(function(num) {\n sum += parseInt(num, 10);\n });\n\n sum = sum.toString(10);\n\n sum = sum.substr(0, 1) + sum.substr(2);\n\n let firstTen = sum.slice(0, 10);\n return parseInt(firstTen, 10);\n}"],
|
||||
"solutions": [
|
||||
"function largeSum(arr) {\n\n let sum = 0;\n\n arr.forEach(function(num) {\n sum += parseInt(num, 10);\n });\n\n sum = sum.toString(10);\n\n sum = sum.substr(0, 1) + sum.substr(2);\n\n let firstTen = sum.slice(0, 10);\n return parseInt(firstTen, 10);\n}"
|
||||
],
|
||||
"translations": {},
|
||||
"head": [
|
||||
"const fiftyDigitNums = [",
|
||||
@ -664,7 +680,9 @@
|
||||
"assert.strictEqual(longestCollatzSequence(5847), 3711, 'message: <code>longestCollatzSequence(5847)</code> should return 3711.');",
|
||||
"assert.strictEqual(longestCollatzSequence(1000000), 837799, 'message: <code>longestCollatzSequence(1000000)</code> should return 837799.');"
|
||||
],
|
||||
"solutions": ["function longestCollatzSequence(limit) {\n let longestSequenceLength = 0;\n let startingNum = 0;\n\n function sequenceLength(num) {\n let length = 1;\n\n while (num >= 1) {\n if (num === 1) { break;\n } else if (num % 2 === 0) {\n num = num / 2;\n length++;\n } else {\n num = num * 3 + 1;\n length++;\n }\n }\n return length;\n }\n\n for (let i = 2; i < limit; i++) {\n let currSequenceLength = sequenceLength(i);\n if (currSequenceLength > longestSequenceLength) {\n longestSequenceLength = currSequenceLength;\n startingNum = i;\n }\n }\n return startingNum;\n}"],
|
||||
"solutions": [
|
||||
"function longestCollatzSequence(limit) {\n let longestSequenceLength = 0;\n let startingNum = 0;\n\n function sequenceLength(num) {\n let length = 1;\n\n while (num >= 1) {\n if (num === 1) { break;\n } else if (num % 2 === 0) {\n num = num / 2;\n length++;\n } else {\n num = num * 3 + 1;\n length++;\n }\n }\n return length;\n }\n\n for (let i = 2; i < limit; i++) {\n let currSequenceLength = sequenceLength(i);\n if (currSequenceLength > longestSequenceLength) {\n longestSequenceLength = currSequenceLength;\n startingNum = i;\n }\n }\n return startingNum;\n}"
|
||||
],
|
||||
"translations": {},
|
||||
"challengeSeed": [
|
||||
"function longestCollatzSequence(limit) {",
|
||||
@ -694,7 +712,9 @@
|
||||
"assert.strictEqual(latticePaths(9), 48620, 'message: <code>latticePaths(9)</code> should return 48620.');",
|
||||
"assert.strictEqual(latticePaths(20), 137846528820, 'message: <code>latticePaths(20)</code> should return 137846528820.');"
|
||||
],
|
||||
"solutions": ["function latticePaths(gridSize) {\n let paths = 1;\n\n for (let i = 0; i < gridSize; i++) {\n paths *= (2 * gridSize) - i;\n paths /= i + 1;\n }\n return paths;\n}"],
|
||||
"solutions": [
|
||||
"function latticePaths(gridSize) {\n let paths = 1;\n\n for (let i = 0; i < gridSize; i++) {\n paths *= (2 * gridSize) - i;\n paths /= i + 1;\n }\n return paths;\n}"
|
||||
],
|
||||
"translations": {},
|
||||
"challengeSeed": [
|
||||
"function latticePaths(gridSize) {",
|
||||
@ -722,7 +742,9 @@
|
||||
"assert.strictEqual(powerDigitSum(128), 166, 'message: <code>powerDigitSum(128)</code> should return 166.');",
|
||||
"assert.strictEqual(powerDigitSum(1000), 1366, 'message: <code>powerDigitSum(1000)</code> should return 1366.');"
|
||||
],
|
||||
"solutions": ["function powerDigitSum(exponent) {\n const bigNum = [1];\n let sum = 0;\n\n for (let i = 1; i <= exponent; i++) {\n let count = bigNum.length + 1;\n let overflow = 0;\n for (let j = 0; j < count; j++) {\n let digit = bigNum[j] || 0;\n digit = 2 * digit + overflow;\n\n if (digit > 9) {\n digit -= 10;\n overflow = 1;\n } else {\n overflow = 0;\n }\n\n bigNum[j] = digit;\n }\n }\n\n bigNum.forEach(function(num) {\n return sum += num;\n });\n\n return sum;\n}"],
|
||||
"solutions": [
|
||||
"function powerDigitSum(exponent) {\n const bigNum = [1];\n let sum = 0;\n\n for (let i = 1; i <= exponent; i++) {\n let count = bigNum.length + 1;\n let overflow = 0;\n for (let j = 0; j < count; j++) {\n let digit = bigNum[j] || 0;\n digit = 2 * digit + overflow;\n\n if (digit > 9) {\n digit -= 10;\n overflow = 1;\n } else {\n overflow = 0;\n }\n\n bigNum[j] = digit;\n }\n }\n\n bigNum.forEach(function(num) {\n return sum += num;\n });\n\n return sum;\n}"
|
||||
],
|
||||
"translations": {},
|
||||
"challengeSeed": [
|
||||
"function powerDigitSum(exponent) {",
|
||||
@ -747,7 +769,9 @@
|
||||
"assert.strictEqual(numberLetterCounts(150), 1903, 'message: <code>numberLetterCounts(150)</code> should return 1903.');",
|
||||
"assert.strictEqual(numberLetterCounts(1000), 21124, 'message: <code>numberLetterCounts(1000)</code> should return 21124.');"
|
||||
],
|
||||
"solutions": ["function numberLetterCounts(limit) {\n const dictionary = {\n 0: '',\n 1: 'one',\n 2: 'two',\n 3: 'three',\n 4: 'four',\n 5: 'five',\n 6: 'six',\n 7: 'seven',\n 8: 'eight',\n 9: 'nine',\n 10: 'ten',\n 11: 'eleven',\n 12: 'twelve',\n 13: 'thirteen',\n 14: 'fourteen',\n 15: 'fifteen',\n 16: 'sixteen',\n 17: 'seventeen',\n 18: 'eighteen',\n 19: 'nineteen',\n 20: 'twenty',\n 30: 'thirty',\n 40: 'forty',\n 50: 'fifty',\n 60: 'sixty',\n 70: 'seventy',\n 80: 'eighty',\n 90: 'ninety',\n 1000: 'onethousand'\n };\n\n let numString = '';\n\n function convertToString(num) {\n // check dictionary for number\n if (dictionary[num]) {\n return dictionary[num];\n } else {\n const hundreds = Math.floor(num / 100);\n const tens = Math.floor((num / 10) % 10) * 10;\n const remainder = num % 10;\n\n let tempStr = '';\n\n if (hundreds === 0) {\n tempStr += dictionary[tens] + dictionary[remainder];\n } else {\n tempStr += dictionary[hundreds] + 'hundred';\n\n if (tens !== 0 || remainder !== 0) {\n tempStr += 'and';\n }\n\n if (tens < 20) {\n const lessThanTwenty = tens + remainder;\n tempStr += dictionary[lessThanTwenty];\n } else {\n tempStr += dictionary[tens] + dictionary[remainder];\n }\n }\n // console.log(num, hundreds, tens, remainder);\n return tempStr;\n }\n }\n\n for (let i = 1; i <= limit; i++) {\n numString += convertToString(i);\n }\n return numString.length;\n}"],
|
||||
"solutions": [
|
||||
"function numberLetterCounts(limit) {\n const dictionary = {\n 0: '',\n 1: 'one',\n 2: 'two',\n 3: 'three',\n 4: 'four',\n 5: 'five',\n 6: 'six',\n 7: 'seven',\n 8: 'eight',\n 9: 'nine',\n 10: 'ten',\n 11: 'eleven',\n 12: 'twelve',\n 13: 'thirteen',\n 14: 'fourteen',\n 15: 'fifteen',\n 16: 'sixteen',\n 17: 'seventeen',\n 18: 'eighteen',\n 19: 'nineteen',\n 20: 'twenty',\n 30: 'thirty',\n 40: 'forty',\n 50: 'fifty',\n 60: 'sixty',\n 70: 'seventy',\n 80: 'eighty',\n 90: 'ninety',\n 1000: 'onethousand'\n };\n\n let numString = '';\n\n function convertToString(num) {\n // check dictionary for number\n if (dictionary[num]) {\n return dictionary[num];\n } else {\n const hundreds = Math.floor(num / 100);\n const tens = Math.floor((num / 10) % 10) * 10;\n const remainder = num % 10;\n\n let tempStr = '';\n\n if (hundreds === 0) {\n tempStr += dictionary[tens] + dictionary[remainder];\n } else {\n tempStr += dictionary[hundreds] + 'hundred';\n\n if (tens !== 0 || remainder !== 0) {\n tempStr += 'and';\n }\n\n if (tens < 20) {\n const lessThanTwenty = tens + remainder;\n tempStr += dictionary[lessThanTwenty];\n } else {\n tempStr += dictionary[tens] + dictionary[remainder];\n }\n }\n // console.log(num, hundreds, tens, remainder);\n return tempStr;\n }\n }\n\n for (let i = 1; i <= limit; i++) {\n numString += convertToString(i);\n }\n return numString.length;\n}"
|
||||
],
|
||||
"translations": {},
|
||||
"challengeSeed": [
|
||||
"function numberLetterCounts(limit) {",
|
||||
@ -772,7 +796,9 @@
|
||||
"assert.strictEqual(maximumPathSumI(testTriangle), 23, 'message: <code>maximumPathSumI(testTriangle)</code> should return 23.');",
|
||||
"assert.strictEqual(maximumPathSumI(numTriangle), 1074, 'message: <code>maximumPathSumI(numTriangle)</code> should return 1074.');"
|
||||
],
|
||||
"solutions": ["const testTriangle = [[3, 0, 0, 0],\n [7, 4, 0, 0],\n [2, 4, 6, 0],\n [8, 5, 9, 3]];\n\nfunction maximumPathSumI(triangle) {\n let maxSum = triangle.slice();\n\n for (let i = triangle.length - 1; i > 0; i--) {\n let currentRow = maxSum[i];\n let previousRow = maxSum[i - 1];\n const temp = [];\n for (let j = 0; j < i; j++) {\n temp.push(Math.max((currentRow[j] + previousRow[j]), (currentRow[j + 1] + previousRow[j])));\n }\n maxSum[i - 1] = temp;\n maxSum.pop();\n }\n return maxSum[0][0];\n}"],
|
||||
"solutions": [
|
||||
"const testTriangle = [[3, 0, 0, 0],\n [7, 4, 0, 0],\n [2, 4, 6, 0],\n [8, 5, 9, 3]];\n\nfunction maximumPathSumI(triangle) {\n let maxSum = triangle.slice();\n\n for (let i = triangle.length - 1; i > 0; i--) {\n let currentRow = maxSum[i];\n let previousRow = maxSum[i - 1];\n const temp = [];\n for (let j = 0; j < i; j++) {\n temp.push(Math.max((currentRow[j] + previousRow[j]), (currentRow[j + 1] + previousRow[j])));\n }\n maxSum[i - 1] = temp;\n maxSum.pop();\n }\n return maxSum[0][0];\n}"
|
||||
],
|
||||
"translations": {},
|
||||
"head": [
|
||||
"const numTriangle = [[75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [95, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [17, 47, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [18, 35, 87, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [20, 4, 82, 47, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [19, 1, 23, 75, 3, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0], [88, 2, 77, 73, 7, 63, 67, 0, 0, 0, 0, 0, 0, 0, 0], [99, 65, 4, 28, 6, 16, 70, 92, 0, 0, 0, 0, 0, 0, 0], [41, 41, 26, 56, 83, 40, 80, 70, 33, 0, 0, 0, 0, 0, 0], [41, 48, 72, 33, 47, 32, 37, 16, 94, 29, 0, 0, 0, 0, 0], [53, 71, 44, 65, 25, 43, 91, 52, 97, 51, 14, 0, 0, 0, 0], [70, 11, 33, 28, 77, 73, 17, 78, 39, 68, 17, 57, 0, 0, 0], [91, 71, 52, 38, 17, 14, 91, 43, 58, 50, 27, 29, 48, 0, 0], [63, 66, 4, 68, 89, 53, 67, 30, 73, 16, 69, 87, 40, 31, 0], [4, 62, 98, 27, 23, 9, 70, 98, 73, 93, 38, 53, 60, 4, 23]];"
|
||||
@ -809,7 +835,9 @@
|
||||
"assert.strictEqual(countingSundays(1995, 2000), 9, 'message: <code>countingSundays(1995, 2000)</code> should return 9.');",
|
||||
"assert.strictEqual(countingSundays(1901, 2000), 171, 'message: <code>countingSundays(1901, 2000)</code> should return 171.');"
|
||||
],
|
||||
"solutions": ["function countingSundays(firstYear, lastYear) {\n let sundays = 0;\n\n for (let year = firstYear; year <= lastYear; year++) {\n for (let month = 1; month <= 12; month++) {\n const thisDate = new Date(year, month, 1);\n if (thisDate.getDay() === 0) {\n sundays++;\n }\n }\n }\n return sundays;\n}"],
|
||||
"solutions": [
|
||||
"function countingSundays(firstYear, lastYear) {\n let sundays = 0;\n\n for (let year = firstYear; year <= lastYear; year++) {\n for (let month = 1; month <= 12; month++) {\n const thisDate = new Date(year, month, 1);\n if (thisDate.getDay() === 0) {\n sundays++;\n }\n }\n }\n return sundays;\n}"
|
||||
],
|
||||
"translations": {},
|
||||
"challengeSeed": [
|
||||
"function countingSundays(firstYear, lastYear) {",
|
||||
@ -866,10 +894,10 @@
|
||||
"type": "bonfire",
|
||||
"title": "Problem 21: Amicable numbers",
|
||||
"tests": [
|
||||
"assert.strictEqual(sumAmicableNum(1000), 504, 'message: \u003ccode\u003esumAmicableNum(1000)\u003c/code\u003e should return 504.');",
|
||||
"assert.strictEqual(sumAmicableNum(2000), 2898, 'message: \u003ccode\u003esumAmicableNum(2000)\u003c/code\u003e should return 2898.');",
|
||||
"assert.strictEqual(sumAmicableNum(5000), 8442, 'message: \u003ccode\u003esumAmicableNum(5000)\u003c/code\u003e should return 8442.');",
|
||||
"assert.strictEqual(sumAmicableNum(10000), 31626, 'message: \u003ccode\u003esumAmicableNum(10000)\u003c/code\u003e should return 31626.');"
|
||||
"assert.strictEqual(sumAmicableNum(1000), 504, 'message: <code>sumAmicableNum(1000)</code> should return 504.');",
|
||||
"assert.strictEqual(sumAmicableNum(2000), 2898, 'message: <code>sumAmicableNum(2000)</code> should return 2898.');",
|
||||
"assert.strictEqual(sumAmicableNum(5000), 8442, 'message: <code>sumAmicableNum(5000)</code> should return 8442.');",
|
||||
"assert.strictEqual(sumAmicableNum(10000), 31626, 'message: <code>sumAmicableNum(10000)</code> should return 31626.');"
|
||||
],
|
||||
"solutions": [],
|
||||
"translations": {},
|
||||
@ -1590,19 +1618,19 @@
|
||||
"description": [
|
||||
"Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:",
|
||||
"Triangle",
|
||||
" ",
|
||||
"",
|
||||
"Tn=n(n+1)/2",
|
||||
" ",
|
||||
"",
|
||||
"1, 3, 6, 10, 15, ...",
|
||||
"Pentagonal",
|
||||
" ",
|
||||
"",
|
||||
"Pn=n(3n−1)/2",
|
||||
" ",
|
||||
"",
|
||||
"1, 5, 12, 22, 35, ...",
|
||||
"Hexagonal",
|
||||
" ",
|
||||
"",
|
||||
"Hn=n(2n−1)",
|
||||
" ",
|
||||
"",
|
||||
"1, 6, 15, 28, 45, ...",
|
||||
"It can be verified that T285 = P165 = H143 = 40755.",
|
||||
"Find the next triangle number that is also pentagonal and hexagonal."
|
||||
@ -2045,34 +2073,34 @@
|
||||
"description": [
|
||||
"Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae:",
|
||||
"Triangle",
|
||||
" ",
|
||||
"",
|
||||
"P3,n=n(n+1)/2",
|
||||
" ",
|
||||
"",
|
||||
"1, 3, 6, 10, 15, ...",
|
||||
"Square",
|
||||
" ",
|
||||
"",
|
||||
"P4,n=n2",
|
||||
" ",
|
||||
"",
|
||||
"1, 4, 9, 16, 25, ...",
|
||||
"Pentagonal",
|
||||
" ",
|
||||
"",
|
||||
"P5,n=n(3n−1)/2",
|
||||
" ",
|
||||
"",
|
||||
"1, 5, 12, 22, 35, ...",
|
||||
"Hexagonal",
|
||||
" ",
|
||||
"",
|
||||
"P6,n=n(2n−1)",
|
||||
" ",
|
||||
"",
|
||||
"1, 6, 15, 28, 45, ...",
|
||||
"Heptagonal",
|
||||
" ",
|
||||
"",
|
||||
"P7,n=n(5n−3)/2",
|
||||
" ",
|
||||
"",
|
||||
"1, 7, 18, 34, 55, ...",
|
||||
"Octagonal",
|
||||
" ",
|
||||
"",
|
||||
"P8,n=n(3n−2)",
|
||||
" ",
|
||||
"",
|
||||
"1, 8, 21, 40, 65, ...",
|
||||
"The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties.",
|
||||
"The set is cyclic, in that the last two digits of each number is the first two digits of the next number (including the last number with the first).",
|
||||
@ -2150,16 +2178,16 @@
|
||||
"",
|
||||
"√N = a0 +",
|
||||
"1",
|
||||
" ",
|
||||
"",
|
||||
"a1 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"a2 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"a3 + ...",
|
||||
"",
|
||||
"For example, let us consider √23:",
|
||||
@ -2168,9 +2196,9 @@
|
||||
"1",
|
||||
" = 4 + ",
|
||||
"1",
|
||||
" ",
|
||||
"",
|
||||
"1√23—4",
|
||||
" ",
|
||||
"",
|
||||
"1 + ",
|
||||
"√23 – 37",
|
||||
"",
|
||||
@ -2178,77 +2206,77 @@
|
||||
"",
|
||||
"√23 = 4 +",
|
||||
"1",
|
||||
" ",
|
||||
"",
|
||||
"1 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"3 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"1 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"8 + ...",
|
||||
"",
|
||||
"The process can be summarised as follows:",
|
||||
"",
|
||||
"a0 = 4,",
|
||||
" ",
|
||||
"",
|
||||
"1√23—4",
|
||||
" = ",
|
||||
"√23+47",
|
||||
" = 1 + ",
|
||||
"√23—37",
|
||||
"a1 = 1,",
|
||||
" ",
|
||||
"",
|
||||
"7√23—3",
|
||||
" = ",
|
||||
"7(√23+3)14",
|
||||
" = 3 + ",
|
||||
"√23—32",
|
||||
"a2 = 3,",
|
||||
" ",
|
||||
"",
|
||||
"2√23—3",
|
||||
" = ",
|
||||
"2(√23+3)14",
|
||||
" = 1 + ",
|
||||
"√23—47",
|
||||
"a3 = 1,",
|
||||
" ",
|
||||
"",
|
||||
"7√23—4",
|
||||
" = ",
|
||||
"7(√23+4)7",
|
||||
" = 8 + ",
|
||||
"√23—4",
|
||||
"a4 = 8,",
|
||||
" ",
|
||||
"",
|
||||
"1√23—4",
|
||||
" = ",
|
||||
"√23+47",
|
||||
" = 1 + ",
|
||||
"√23—37",
|
||||
"a5 = 1,",
|
||||
" ",
|
||||
"",
|
||||
"7√23—3",
|
||||
" = ",
|
||||
"7(√23+3)14",
|
||||
" = 3 + ",
|
||||
"√23—32",
|
||||
"a6 = 3,",
|
||||
" ",
|
||||
"",
|
||||
"2√23—3",
|
||||
" = ",
|
||||
"2(√23+3)14",
|
||||
" = 1 + ",
|
||||
"√23—47",
|
||||
"a7 = 1,",
|
||||
" ",
|
||||
"",
|
||||
"7√23—4",
|
||||
" = ",
|
||||
"7(√23+4)7",
|
||||
@ -2295,22 +2323,22 @@
|
||||
"",
|
||||
"√2 = 1 +",
|
||||
"1",
|
||||
" ",
|
||||
"",
|
||||
"2 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"2 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"2 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"2 + ...",
|
||||
"",
|
||||
"The infinite continued fraction can be written, √2 = [1;(2)], (2) indicates that 2 repeats ad infinitum. In a similar way, √23 = [4;(1,3,1,8)].",
|
||||
@ -2320,59 +2348,59 @@
|
||||
"1 +",
|
||||
"1",
|
||||
"= 3/2",
|
||||
" ",
|
||||
"",
|
||||
"2",
|
||||
" ",
|
||||
"",
|
||||
"1 +",
|
||||
"1",
|
||||
"= 7/5",
|
||||
" ",
|
||||
"",
|
||||
"2 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"2",
|
||||
" ",
|
||||
"",
|
||||
"1 +",
|
||||
"1",
|
||||
"= 17/12",
|
||||
" ",
|
||||
"",
|
||||
"2 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"2 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"2",
|
||||
" ",
|
||||
"",
|
||||
"1 +",
|
||||
"1",
|
||||
"= 41/29",
|
||||
" ",
|
||||
"",
|
||||
"2 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"2 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"2 +",
|
||||
"1",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"2",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"Hence the sequence of the first ten convergents for √2 are:",
|
||||
"1, 3/2, 7/5, 17/12, 41/29, 99/70, 239/169, 577/408, 1393/985, 3363/2378, ...",
|
||||
@ -2984,31 +3012,31 @@
|
||||
"B3",
|
||||
"JAIL",
|
||||
"H2",
|
||||
" ",
|
||||
"",
|
||||
"C1",
|
||||
"T2",
|
||||
" ",
|
||||
"",
|
||||
"U1",
|
||||
"H1",
|
||||
" ",
|
||||
"",
|
||||
"C2",
|
||||
"CH3",
|
||||
" ",
|
||||
"",
|
||||
"C3",
|
||||
"R4",
|
||||
" ",
|
||||
"",
|
||||
"R2",
|
||||
"G3",
|
||||
" ",
|
||||
"",
|
||||
"D1",
|
||||
"CC3",
|
||||
" ",
|
||||
"",
|
||||
"CC2",
|
||||
"G2",
|
||||
" ",
|
||||
"",
|
||||
"D2",
|
||||
"G1",
|
||||
" ",
|
||||
"",
|
||||
"D3",
|
||||
"G2J",
|
||||
"F3",
|
||||
@ -3752,9 +3780,7 @@
|
||||
"",
|
||||
"euler108();"
|
||||
],
|
||||
"description": [
|
||||
""
|
||||
]
|
||||
"description": []
|
||||
},
|
||||
{
|
||||
"id": "5900f3db1000cf542c50feec",
|
||||
@ -3785,20 +3811,20 @@
|
||||
"There are exactly eleven distinct ways to checkout on a score of 6:",
|
||||
"",
|
||||
"D3",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"D1",
|
||||
"D2",
|
||||
" ",
|
||||
"",
|
||||
"S2",
|
||||
"D2",
|
||||
" ",
|
||||
"",
|
||||
"D2",
|
||||
"D1",
|
||||
" ",
|
||||
"",
|
||||
"S4",
|
||||
"D1",
|
||||
" ",
|
||||
"",
|
||||
"S1",
|
||||
"S1",
|
||||
"D2",
|
||||
@ -3842,9 +3868,7 @@
|
||||
"",
|
||||
"euler110();"
|
||||
],
|
||||
"description": [
|
||||
""
|
||||
]
|
||||
"description": []
|
||||
},
|
||||
{
|
||||
"id": "5900f3db1000cf542c50feee",
|
||||
@ -4093,7 +4117,7 @@
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" ",
|
||||
"",
|
||||
"How many ways can a row measuring fifty units in length be filled?",
|
||||
"NOTE: Although the example above does not lend itself to the possibility, in general it is permitted to mix block sizes. For example, on a row measuring eight units in length you could use red (3), black (1), and red (4)."
|
||||
]
|
||||
@ -4187,7 +4211,7 @@
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" ",
|
||||
"",
|
||||
"If green tiles are chosen there are three ways.",
|
||||
"",
|
||||
"",
|
||||
@ -4205,7 +4229,7 @@
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" ",
|
||||
"",
|
||||
"And if blue tiles are chosen there are two ways.",
|
||||
"",
|
||||
"",
|
||||
@ -4319,7 +4343,7 @@
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" ",
|
||||
"",
|
||||
"How many ways can a row measuring fifty units in length be tiled?",
|
||||
"NOTE: This is related to Problem 116."
|
||||
]
|
||||
@ -4497,7 +4521,7 @@
|
||||
"The radical of n, rad(n), is the product of the distinct prime factors of n. For example, 504 = 23 × 32 × 7, so rad(504) = 2 × 3 × 7 = 42.",
|
||||
"If we calculate rad(n) for 1 ≤ n ≤ 10, then sort them on rad(n), and sorting on n if the radical values are equal, we get:",
|
||||
"Unsorted",
|
||||
" ",
|
||||
"",
|
||||
"Sorted",
|
||||
"n",
|
||||
"rad(n)",
|
||||
@ -4506,34 +4530,34 @@
|
||||
"rad(n)",
|
||||
"k",
|
||||
"11",
|
||||
" ",
|
||||
"",
|
||||
"111",
|
||||
"22",
|
||||
" ",
|
||||
"",
|
||||
"222",
|
||||
"33",
|
||||
" ",
|
||||
"",
|
||||
"423",
|
||||
"42",
|
||||
" ",
|
||||
"",
|
||||
"824",
|
||||
"55",
|
||||
" ",
|
||||
"",
|
||||
"335",
|
||||
"66",
|
||||
" ",
|
||||
"",
|
||||
"936",
|
||||
"77",
|
||||
" ",
|
||||
"",
|
||||
"557",
|
||||
"82",
|
||||
" ",
|
||||
"",
|
||||
"668",
|
||||
"93",
|
||||
" ",
|
||||
"",
|
||||
"779",
|
||||
"1010",
|
||||
" ",
|
||||
"",
|
||||
"101010",
|
||||
"Let E(k) be the kth element in the sorted n column; for example, E(4) = 8 and E(6) = 9.",
|
||||
"If rad(n) is sorted for 1 ≤ n ≤ 100000, find E(10000)."
|
||||
@ -4880,10 +4904,10 @@
|
||||
"Surprisingly AF(1/2)",
|
||||
" = ",
|
||||
"(1/2).1 + (1/2)2.1 + (1/2)3.2 + (1/2)4.3 + (1/2)5.5 + ...",
|
||||
" ",
|
||||
"",
|
||||
" = ",
|
||||
"1/2 + 1/4 + 2/8 + 3/16 + 5/32 + ...",
|
||||
" ",
|
||||
"",
|
||||
" = ",
|
||||
"2",
|
||||
"The corresponding values of x for the first five natural numbers are shown below.",
|
||||
@ -5196,75 +5220,75 @@
|
||||
],
|
||||
"description": [
|
||||
"We can easily verify that none of the entries in the first seven rows of Pascal's triangle are divisible by 7:",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" 1",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" 1",
|
||||
" ",
|
||||
"",
|
||||
" 1",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" 1",
|
||||
" ",
|
||||
"",
|
||||
" 2",
|
||||
" ",
|
||||
"",
|
||||
" 1",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
" 1",
|
||||
" ",
|
||||
"",
|
||||
" 3",
|
||||
" ",
|
||||
"",
|
||||
" 3",
|
||||
" ",
|
||||
"",
|
||||
" 1",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
"",
|
||||
" 1",
|
||||
" ",
|
||||
"",
|
||||
" 4",
|
||||
" ",
|
||||
"",
|
||||
" 6",
|
||||
" ",
|
||||
"",
|
||||
" 4",
|
||||
" ",
|
||||
"",
|
||||
" 1",
|
||||
" ",
|
||||
"",
|
||||
" 1",
|
||||
" ",
|
||||
"",
|
||||
" 5",
|
||||
" ",
|
||||
"",
|
||||
"10",
|
||||
" ",
|
||||
"",
|
||||
"10",
|
||||
" ",
|
||||
"",
|
||||
" 5",
|
||||
" ",
|
||||
"",
|
||||
" 1",
|
||||
"1",
|
||||
" ",
|
||||
"",
|
||||
" 6",
|
||||
" ",
|
||||
"",
|
||||
"15",
|
||||
" ",
|
||||
"",
|
||||
"20",
|
||||
" ",
|
||||
"",
|
||||
"15",
|
||||
" ",
|
||||
"",
|
||||
" 6",
|
||||
" ",
|
||||
"",
|
||||
" 1",
|
||||
"However, if we check the first one hundred rows, we will find that only 2361 of the 5050 entries are not divisible by 7.",
|
||||
"",
|
||||
@ -14990,9 +15014,7 @@
|
||||
"",
|
||||
"euler428();"
|
||||
],
|
||||
"description": [
|
||||
""
|
||||
]
|
||||
"description": []
|
||||
},
|
||||
{
|
||||
"id": "5900f5191000cf542c51002c",
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -276,8 +276,7 @@
|
||||
},
|
||||
{
|
||||
"subtitle": "CSS rules",
|
||||
"question": "What will the following css rule select?\n<pre><code class='language-javascript'>.test > div</code> {\n...\n}</code></pre>"
|
||||
,
|
||||
"question": "What will the following css rule select?\n<pre><code class='language-javascript'>.test > div</code> {\n...\n}</code></pre>",
|
||||
"choices": [
|
||||
"<pre><code class='language-javascript'>Selects all divs within elements with the class of test.</code></pre>",
|
||||
"<pre><code class='language-javascript'>Selects all divs outside of elements with the class of test.</code></pre>",
|
||||
@ -403,8 +402,7 @@
|
||||
},
|
||||
{
|
||||
"subtitle": "CSS Browser compatibility",
|
||||
"question": "Which is not a valid Css prefix to ensure browser compatibility?"
|
||||
,
|
||||
"question": "Which is not a valid Css prefix to ensure browser compatibility?",
|
||||
"choices": [
|
||||
"<pre><code class='language-javascript'>-webkit-</code></pre>",
|
||||
"<pre><code class='language-javascript'>-win-</code></pre>",
|
||||
|
Reference in New Issue
Block a user