Fix: remove quote from challenge where not needed [english] (#35493)
This commit is contained in:
committed by
The Coding Aviator
parent
4d1d89b1c7
commit
228d873dd3
@ -9,7 +9,7 @@ videoUrl: 'https://scrimba.com/p/pVMPUv/cra98AJ'
|
||||
<section id='description'>
|
||||
The challenges so far have covered specific HTML elements and their uses. However, there are a few elements that give overall structure to your page, and should be included in every HTML document.
|
||||
At the top of your document, you need to tell the browser which version of HTML your page is using. HTML is an evolving language, and is updated regularly. Most major browsers support the latest specification, which is HTML5. However, older web pages may use previous versions of the language.
|
||||
You tell the browser this information by adding the <code><!DOCTYPE ...></code> tag on the first line, where the "<code>...</code>" part is the version of HTML. For HTML5, you use <code><!DOCTYPE html></code>.
|
||||
You tell the browser this information by adding the <code><!DOCTYPE ...></code> tag on the first line, where the <code>...</code> part is the version of HTML. For HTML5, you use <code><!DOCTYPE html></code>.
|
||||
The <code>!</code> and uppercase <code>DOCTYPE</code> is important, especially for older browsers. The <code>html</code> is not case sensitive.
|
||||
Next, the rest of your HTML code needs to be wrapped in <code>html</code> tags. The opening <code><html></code> goes directly below the <code><!DOCTYPE html></code> line, and the closing <code></html></code> goes at the end of the page.
|
||||
Here's an example of the page structure:
|
||||
|
@ -7,7 +7,7 @@ videoUrl: 'https://scrimba.com/c/cDqWGcp'
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
The next type of loop you will learn is called a "<code>do...while</code>" loop. It is called a <code>do...while</code> loop because it will first "<code>do</code>" one pass of the code inside the loop no matter what, and then continue to run the loop "<code>while</code>" the specified condition evaluates to <code>true</code>.
|
||||
The next type of loop you will learn is called a <code>do...while</code> loop. It is called a <code>do...while</code> loop because it will first <code>do</code> one pass of the code inside the loop no matter what, and then continue to run the loop <code>while</code> the specified condition evaluates to <code>true</code>.
|
||||
<blockquote>var ourArray = [];<br>var i = 0;<br>do {<br> ourArray.push(i);<br> i++;<br>} while (i < 5);</blockquote>
|
||||
The example above behaves similar to other types of loops, and the resulting array will look like <code>[0, 1, 2, 3, 4]</code>. However, what makes the <code>do...while</code> different from other loops is how it behaves when the condition fails on the first check. Let's see this in action:
|
||||
Here is a regular <code>while</code> loop that will run the code in the loop as long as <code>i < 5</code>:
|
||||
|
@ -8,7 +8,7 @@ videoUrl: 'https://scrimba.com/c/c9yNVCe'
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can run the same code multiple times by using a loop.
|
||||
The most common type of JavaScript loop is called a "<code>for loop</code>" because it runs "for" a specific number of times.
|
||||
The most common type of JavaScript loop is called a <code>for loop</code> because it runs "for" a specific number of times.
|
||||
For loops are declared with three optional expressions separated by semicolons:
|
||||
<code>for ([initialization]; [condition]; [final-expression])</code>
|
||||
The <code>initialization</code> statement is executed one time only before the loop starts. It is typically used to define and setup your loop variable.
|
||||
|
@ -8,7 +8,7 @@ videoUrl: 'https://scrimba.com/c/c8QbnCM'
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can run the same code multiple times by using a loop.
|
||||
The first type of loop we will learn is called a "<code>while</code>" loop because it runs "while" a specified condition is true and stops once that condition is no longer true.
|
||||
The first type of loop we will learn is called a <code>while</code> loop because it runs "while" a specified condition is true and stops once that condition is no longer true.
|
||||
<blockquote>var ourArray = [];<br>var i = 0;<br>while(i < 5) {<br> ourArray.push(i);<br> i++;<br>}</blockquote>
|
||||
Let's try getting a while loop to work by pushing values to an array.
|
||||
</section>
|
||||
|
@ -27,7 +27,7 @@ Modify the code to show the correct prototype chain.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should show that <code>Object.prototype</code> is the prototype of <code>Dog.prototype</code>")
|
||||
- text: Your code should show that <code>Object.prototype</code> is the prototype of <code>Dog.prototype</code>
|
||||
testString: assert(/Object\.prototype\.isPrototypeOf/.test(code), "Your code should show that <code>Object.prototype</code> is the prototype of <code>Dog.prototype</code>");
|
||||
|
||||
```
|
||||
|
@ -24,20 +24,20 @@ Write a <code>greedy</code> regex that finds one or more criminals within a grou
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Your regex should match <code>one</code> criminal ("<code>C</code>") in <code>"C"</code>
|
||||
testString: assert('C'.match(reCriminals) && 'C'.match(reCriminals)[0] == 'C', 'Your regex should match <code>one</code> criminal ("<code>C</code>") in <code>"C"</code>');
|
||||
- text: Your regex should match <code>two</code> criminals ("<code>CC</code>") in <code>"CC"</code>
|
||||
testString: assert('CC'.match(reCriminals) && 'CC'.match(reCriminals)[0] == 'CC', 'Your regex should match <code>two</code> criminals ("<code>CC</code>") in <code>"CC"</code>');
|
||||
- text: Your regex should match <code>three</code> criminals ("<code>CCC</code>") in <code>"P1P5P4CCCP2P6P3"</code>
|
||||
testString: assert('P1P5P4CCCP2P6P3'.match(reCriminals) && 'P1P5P4CCCP2P6P3'.match(reCriminals)[0] == 'CCC', 'Your regex should match <code>three</code> criminals ("<code>CCC</code>") in <code>"P1P5P4CCCP2P6P3"</code>');
|
||||
- text: Your regex should match <code>five</code> criminals ("<code>CCCCC</code>") in <code>"P6P2P7P4P5CCCCCP3P1"</code>
|
||||
testString: assert('P6P2P7P4P5CCCCCP3P1'.match(reCriminals) && 'P6P2P7P4P5CCCCCP3P1'.match(reCriminals)[0] == 'CCCCC', 'Your regex should match <code>five</code> criminals ("<code>CCCCC</code>") in <code>"P6P2P7P4P5CCCCCP3P1"</code>');
|
||||
- text: Your regex should match <code>one</code> criminal (<code>C</code>) in <code>"C"</code>
|
||||
testString: assert('C'.match(reCriminals) && 'C'.match(reCriminals)[0] == 'C', 'Your regex should match <code>one</code> criminal (<code>C</code>) in <code>"C"</code>');
|
||||
- text: Your regex should match <code>two</code> criminals (<code>CC</code>) in <code>"CC"</code>
|
||||
testString: assert('CC'.match(reCriminals) && 'CC'.match(reCriminals)[0] == 'CC', 'Your regex should match <code>two</code> criminals (<code>CC</code>) in <code>"CC"</code>');
|
||||
- text: Your regex should match <code>three</code> criminals (<code>CCC</code>) in <code>"P1P5P4CCCP2P6P3"</code>
|
||||
testString: assert('P1P5P4CCCP2P6P3'.match(reCriminals) && 'P1P5P4CCCP2P6P3'.match(reCriminals)[0] == 'CCC', 'Your regex should match <code>three</code> criminals (<code>CCC</code>) in <code>"P1P5P4CCCP2P6P3"</code>');
|
||||
- text: Your regex should match <code>five</code> criminals (<code>CCCCC</code>) in <code>"P6P2P7P4P5CCCCCP3P1"</code>
|
||||
testString: assert('P6P2P7P4P5CCCCCP3P1'.match(reCriminals) && 'P6P2P7P4P5CCCCCP3P1'.match(reCriminals)[0] == 'CCCCC', 'Your regex should match <code>five</code> criminals (<code>CCCCC</code>) in <code>"P6P2P7P4P5CCCCCP3P1"</code>');
|
||||
- text: Your regex should not match any criminals in <code>""</code>
|
||||
testString: assert(!reCriminals.test(''), 'Your regex should not match any criminals in <code>""</code>');
|
||||
- text: Your regex should not match any criminals in <code>"P1P2P3"</code>
|
||||
testString: assert(!reCriminals.test('P1P2P3'), 'Your regex should not match any criminals in <code>"P1P2P3"</code>');
|
||||
- text: Your regex should match <code>fifty</code> criminals ("<code>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</code>") in <code>"P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3"</code>.
|
||||
testString: assert('P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals) && 'P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals)[0] == "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", 'Your regex should match <code>fifty</code> criminals ("<code>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</code>") in <code>"P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3"</code>.');
|
||||
- text: Your regex should match <code>fifty</code> criminals (<code>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</code>) in <code>"P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3"</code>.
|
||||
testString: assert('P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals) && 'P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3'.match(reCriminals)[0] == "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", 'Your regex should match <code>fifty</code> criminals (<code>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</code>) in <code>"P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3"</code>.');
|
||||
|
||||
```
|
||||
|
||||
|
@ -24,13 +24,13 @@ tests:
|
||||
testString: assert((function(){var test = new Set(); return (typeof test.subset === 'function')})(), 'Your <code>Set</code> class should have a <code>union</code> method.');
|
||||
- text: The first Set() was contained in the second Set
|
||||
testString: assert((function(){var setA = new Set(); var setB = new Set(); setA.add('a'); setB.add('b'); setB.add('c'); setB.add('a'); setB.add('d'); var subsetSetAB = setA.subset(setB);return (subsetSetAB === true)})(), 'The first Set() was contained in the second Set');
|
||||
- text: <code>['a', 'b'].subset(['a', 'b', 'c', 'd'])</code> should return <code>true</code>")
|
||||
- text: <code>['a', 'b'].subset(['a', 'b', 'c', 'd'])</code> should return <code>true</code>
|
||||
testString: assert((function(){var setA = new Set(); var setB = new Set(); setA.add('a'); setA.add('b'); setB.add('a'); setB.add('b'); setB.add('c'); setB.add('d'); var subsetSetAB = setA.subset(setB); return (subsetSetAB === true)})(), "<code>['a', 'b'].subset(['a', 'b', 'c', 'd'])</code> should return <code>true</code>");
|
||||
- text: <code>['a', 'b', 'c'].subset(['a', 'b'])</code> should return <code>false</code>")
|
||||
- text: <code>['a', 'b', 'c'].subset(['a', 'b'])</code> should return <code>false</code>
|
||||
testString: assert((function(){var setA = new Set(); var setB = new Set(); setA.add('a'); setA.add('b'); setA.add('c'); setB.add('a'); setB.add('b'); var subsetSetAB = setA.subset(setB); return (subsetSetAB === false)})(), "<code>['a', 'b', 'c'].subset(['a', 'b'])</code> should return <code>false</code>");
|
||||
- text: <code>[].subset([])</code> should return <code>true</code>
|
||||
testString: assert((function(){var setA = new Set(); var setB = new Set(); var subsetSetAB = setA.subset(setB); return (subsetSetAB === true)})(), '<code>[].subset([])</code> should return <code>true</code>');
|
||||
- text: <code>['a', 'b'].subset(['c', 'd'])</code> should return <code>false</code>")
|
||||
- text: <code>['a', 'b'].subset(['c', 'd'])</code> should return <code>false</code>
|
||||
testString: assert((function(){var setA = new Set(); var setB = new Set(); setA.add('a'); setA.add('b'); setB.add('c'); setB.add('d'); var subsetSetAB = setA.subset(setB); return (subsetSetAB === false)})(), "<code>['a', 'b'].subset(['c', 'd'])</code> should return <code>false</code>");
|
||||
|
||||
```
|
||||
|
@ -9,7 +9,7 @@ challengeType: 5
|
||||
Task:
|
||||
<p>Implement a function which:</p>
|
||||
takes a positive integer representing a duration in seconds as input (e.g., <code>100</code>), and
|
||||
returns a string which shows the same duration decomposed into weeks, days, hours, minutes, and seconds as detailed below (e.g., "<code>1 min, 40 sec</code>").
|
||||
returns a string which shows the same duration decomposed into weeks, days, hours, minutes, and seconds as detailed below (e.g., <code>1 min, 40 sec</code>).
|
||||
<p>Demonstrate that it passes the following three test-cases:</p><p style="font-size:115%; margin:1em 0 0 0">Test Cases</p>
|
||||
<table>
|
||||
<tbody>
|
||||
@ -67,7 +67,7 @@ The following five units should be used:
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
However, only include quantities with non-zero values in the output (e.g., return "<code>1 d</code>" and not "<code>0 wk, 1 d, 0 hr, 0 min, 0 sec</code>").Give larger units precedence over smaller ones as much as possible (e.g., return <code>2 min, 10 sec</code> and not <code>1 min, 70 sec</code> or <code>130 sec</code>)Mimic the formatting shown in the test-cases (quantities sorted from largest unit to smallest and separated by comma+space; value and unit of each quantity separated by space).
|
||||
However, only include quantities with non-zero values in the output (e.g., return <code>1 d</code> and not <code>0 wk, 1 d, 0 hr, 0 min, 0 sec</code>).Give larger units precedence over smaller ones as much as possible (e.g., return <code>2 min, 10 sec</code> and not <code>1 min, 70 sec</code> or <code>130 sec</code>)Mimic the formatting shown in the test-cases (quantities sorted from largest unit to smallest and separated by comma+space; value and unit of each quantity separated by space).
|
||||
<p><hr style="margin:1em 0;"/></p>
|
||||
</section>
|
||||
|
||||
|
@ -33,11 +33,11 @@ tests:
|
||||
testString: assert(typeof factorial === 'function', '<code>factorial</code> is a function.');
|
||||
- text: <code>factorial(2)</code> should return a number.
|
||||
testString: assert(typeof factorial(2) === 'number', '<code>factorial(2)</code> should return a number.');
|
||||
- text: <code>factorial(3)</code> should return 6.")
|
||||
- text: <code>factorial(3)</code> should return 6.
|
||||
testString: assert.equal(factorial(3),results[0],"<code>factorial(3)</code> should return 6.");
|
||||
- text: <code>factorial(3)</code> should return 120.")
|
||||
- text: <code>factorial(3)</code> should return 120.
|
||||
testString: assert.equal(factorial(5),results[1],"<code>factorial(3)</code> should return 120.");
|
||||
- text: <code>factorial(3)</code> should return 3,628,800.")
|
||||
- text: <code>factorial(3)</code> should return 3,628,800.
|
||||
testString: assert.equal(factorial(10),results[2],"<code>factorial(3)</code> should return 3,628,800.");
|
||||
|
||||
```
|
||||
|
@ -28,11 +28,11 @@ tests:
|
||||
testString: assert(typeof fibonacci === 'function', '<code>fibonacci</code> is a function.');
|
||||
- text: <code>fibonacci(2)</code> should return a number.
|
||||
testString: assert(typeof fibonacci(2) == 'number', '<code>fibonacci(2)</code> should return a number.');
|
||||
- text: <code>fibonacci(3)</code> should return 1.")
|
||||
- text: <code>fibonacci(3)</code> should return 1.
|
||||
testString: assert.equal(fibonacci(3),1,"<code>fibonacci(3)</code> should return 1.");
|
||||
- text: <code>fibonacci(5)</code> should return 3.")
|
||||
- text: <code>fibonacci(5)</code> should return 3.
|
||||
testString: assert.equal(fibonacci(5),3,"<code>fibonacci(5)</code> should return 3.");
|
||||
- text: <code>fibonacci(10)</code> should return 34.")
|
||||
- text: <code>fibonacci(10)</code> should return 34.
|
||||
testString: assert.equal(fibonacci(10),34,"<code>fibonacci(10)</code> should return 34.");
|
||||
|
||||
```
|
||||
|
@ -59,9 +59,9 @@ for examples of native data structures.)
|
||||
tests:
|
||||
- text: <code>parseSexpr</code> is a function.
|
||||
testString: assert(typeof parseSexpr === 'function', '<code>parseSexpr</code> is a function.');
|
||||
- text: <code>parseSexpr('(data1 data2 data3)')</code> should return ['data1', 'data2', 'data3']")
|
||||
- text: <code>parseSexpr('(data1 data2 data3)')</code> should return <code>['data1', 'data2', 'data3']</code>
|
||||
testString: assert.deepEqual(parseSexpr(simpleSExpr), simpleSolution, "<code>parseSexpr('(data1 data2 data3)')</code> should return ['data1', 'data2', 'data3']");
|
||||
- text: <code>parseSexpr('(data1 data2 data3)')</code> should return an array with 3 elements")
|
||||
- text: <code>parseSexpr('(data1 data2 data3)')</code> should return an array with 3 elements.
|
||||
testString: assert.deepEqual(parseSexpr(basicSExpr), basicSolution, "<code>parseSexpr('(data1 data2 data3)')</code> should return an array with 3 elements");
|
||||
|
||||
```
|
||||
|
@ -52,13 +52,13 @@ challengeType: 5
|
||||
tests:
|
||||
- text: <code>sedol</code> is a function.
|
||||
testString: assert(typeof sedol === 'function', '<code>sedol</code> is a function.');
|
||||
- text: <code>sedol('a')</code> should return null.")
|
||||
- text: <code>sedol('a')</code> should return null.
|
||||
testString: assert(sedol('a') === null, "<code>sedol('a')</code> should return null.");
|
||||
- text: <code>sedol('710889')</code> should return '7108899'.")
|
||||
- text: <code>sedol('710889')</code> should return '7108899'.
|
||||
testString: assert(sedol('710889') === '7108899', "<code>sedol('710889')</code> should return '7108899'.");
|
||||
- text: <code>sedol('BOATER')</code> should return null.")
|
||||
- text: <code>sedol('BOATER')</code> should return null.
|
||||
testString: assert(sedol('BOATER') === null, "<code>sedol('BOATER')</code> should return null.");
|
||||
- text: <code>sedol('228276')</code> should return '2282765'.")
|
||||
- text: <code>sedol('228276')</code> should return '2282765'.
|
||||
testString: assert(sedol('228276') === '2282765', "<code>sedol('228276')</code> should return '2282765'.");
|
||||
|
||||
```
|
||||
|
@ -47,7 +47,7 @@ tests:
|
||||
testString: assert(typeof tokenize === 'function', '<code>tokenize</code> is a function.');
|
||||
- text: <code>tokenize</code> should return an array.
|
||||
testString: assert(typeof tokenize('a', 'b', 'c') === 'object', '<code>tokenize</code> should return an array.');
|
||||
- text: <code>tokenize('one^|uno||three^^^^|four^^^|^cuatro|', '|', '^') </code> should return ['one|uno', '', 'three^^', 'four^|cuatro', '']")
|
||||
- text: <code>tokenize('one^|uno||three^^^^|four^^^|^cuatro|', '|', '^') </code> should return <code>['one|uno', '', 'three^^', 'four^|cuatro', '']</code>
|
||||
testString: assert.deepEqual(tokenize(testStr1, '|', '^'), res1, "<code>tokenize('one^|uno||three^^^^|four^^^|^cuatro|', '|', '^') </code> should return ['one|uno', '', 'three^^', 'four^|cuatro', '']");
|
||||
- text: <code>tokenize('a@&bcd&ef&&@@hi', '&', '@')</code> should return <code>['a&bcd', 'ef', '', '@hi']</code>
|
||||
testString: assert.deepEqual(tokenize(testStr2, '&', '@'), res2, '<code>tokenize("a@&bcd&ef&&@@hi", "&", "@")</code> should return <code>["a&bcd", "ef", "", "@hi"]</code>');
|
||||
|
@ -33,11 +33,11 @@ tests:
|
||||
testString: assert(typeof towerOfHanoi === 'function', '<code>towerOfHanoi</code> is a function.');
|
||||
- text: <code>towerOfHanoi(3, ...)</code> should return 7 moves.
|
||||
testString: assert(res3.length === 7, '<code>towerOfHanoi(3, ...)</code> should return 7 moves.');
|
||||
- text: <code>towerOfHanoi(3, 'A', 'B', 'C')</code> should return [['A','B'],['A','C'],['B','C'],['A','B'],['C','A'],['C','B'],['A','B']].")
|
||||
- text: <code>towerOfHanoi(3, 'A', 'B', 'C')</code> should return <code>[['A','B'],['A','C'],['B','C'],['A','B'],['C','A'],['C','B'],['A','B']]</code>
|
||||
testString: assert.deepEqual(towerOfHanoi(3, 'A', 'B', 'C'), res3Moves, "<code>towerOfHanoi(3, 'A', 'B', 'C')</code> should return [['A','B'],['A','C'],['B','C'],['A','B'],['C','A'],['C','B'],['A','B']].");
|
||||
- text: <code>towerOfHanoi(5, "X", "Y", "Z")</code> 10th move should be Y -> X.
|
||||
testString: assert.deepEqual(res5[9], ['Y', 'X'], '<code>towerOfHanoi(5, "X", "Y", "Z")</code> 10th move should be Y -> X.');
|
||||
- text: <code>towerOfHanoi(7, 'A', 'B', 'C')</code> first ten moves are [['A','B'],['A','C'],['B','C'],['A','B'],['C','A'],['C','B'],['A','B'],['A','C'],['B','C'],['B','A']].")
|
||||
- text: <code>towerOfHanoi(7, 'A', 'B', 'C')</code> first ten moves are <code>[['A','B'],['A','C'],['B','C'],['A','B'],['C','A'],['C','B'],['A','B'],['A','C'],['B','C'],['B','A']]</code>
|
||||
testString: assert.deepEqual(towerOfHanoi(7, 'A', 'B', 'C').slice(0, 10), res7First10Moves, "<code>towerOfHanoi(7, 'A', 'B', 'C')</code> first ten moves are [['A','B'],['A','C'],['B','C'],['A','B'],['C','A'],['C','B'],['A','B'],['A','C'],['B','C'],['B','A']].");
|
||||
|
||||
```
|
||||
|
Reference in New Issue
Block a user