chore: fix typos in spelling (#38100)
* spelling: accidentally * spelling: announce * spelling: assembly * spelling: avoid * spelling: backend * spelling: because * spelling: claimed * spelling: candidate * spelling: certification * spelling: certified * spelling: challenge * spelling: circular * spelling: it isn't * spelling: coins * spelling: combination * spelling: compliant * spelling: containers * spelling: concise * spelling: deprecated * spelling: development * spelling: donor * spelling: error * spelling: everything * spelling: exceed * spelling: exist * spelling: falsy * spelling: faulty * spelling: forward * spelling: handle * spelling: indicates * spelling: initial * spelling: integers * spelling: issealed * spelling: javascript * spelling: length * spelling: maximum * spelling: minimum * spelling: mutable * spelling: notifier * spelling: coordinate * spelling: passport * spelling: perform * spelling: permuter * spelling: placeholder * spelling: progressively * spelling: semantic * spelling: submission * spelling: submit * spelling: translations * spelling: turquoise * spelling: visualization * spelling: without * spelling: registration * spelling: representation
This commit is contained in:
@@ -102,7 +102,7 @@
|
||||
],
|
||||
[
|
||||
"587d7b8c367417b2b2512b55",
|
||||
"Reuse Javascript Code Using import"
|
||||
"Reuse JavaScript Code Using import"
|
||||
],
|
||||
[
|
||||
"587d7b8c367417b2b2512b57",
|
||||
|
@@ -33,8 +33,8 @@ We have defined a function, <code>htmlColorNames</code>, which takes an array of
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>htmlColorNames</code> should return <code>["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurqoise", "FireBrick"]</code>
|
||||
testString: assert.deepEqual(htmlColorNames(['DarkGoldenRod', 'WhiteSmoke', 'LavenderBlush', 'PaleTurqoise', 'FireBrick']), ['DarkSalmon', 'BlanchedAlmond', 'LavenderBlush', 'PaleTurqoise', 'FireBrick']);
|
||||
- text: <code>htmlColorNames</code> should return <code>["DarkSalmon", "BlanchedAlmond", "LavenderBlush", "PaleTurquoise", "FireBrick"]</code>
|
||||
testString: assert.deepEqual(htmlColorNames(['DarkGoldenRod', 'WhiteSmoke', 'LavenderBlush', 'PaleTurquoise', 'FireBrick']), ['DarkSalmon', 'BlanchedAlmond', 'LavenderBlush', 'PaleTurquoise', 'FireBrick']);
|
||||
- text: The <code>htmlColorNames</code> function should utilize the <code>splice()</code> method
|
||||
testString: assert(/.splice/.test(code));
|
||||
- text: You should not use <code>shift()</code> or <code>unshift()</code>.
|
||||
@@ -60,7 +60,7 @@ function htmlColorNames(arr) {
|
||||
}
|
||||
|
||||
// do not change code below this line
|
||||
console.log(htmlColorNames(['DarkGoldenRod', 'WhiteSmoke', 'LavenderBlush', 'PaleTurqoise', 'FireBrick']));
|
||||
console.log(htmlColorNames(['DarkGoldenRod', 'WhiteSmoke', 'LavenderBlush', 'PaleTurquoise', 'FireBrick']));
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@@ -70,7 +70,7 @@ console.clear();
|
||||
// Use console.log() to print the output variable.
|
||||
console.log(output);
|
||||
|
||||
// Check the two consoles to see the difference. The freeCodeCamp console should have printed the variable twice, one for each test of this challenge. The browser console should only print the variable once becuase you cleared it first.
|
||||
// Check the two consoles to see the difference. The freeCodeCamp console should have printed the variable twice, one for each test of this challenge. The browser console should only print the variable once because you cleared it first.
|
||||
```
|
||||
|
||||
</section>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d7b8c367417b2b2512b55
|
||||
title: Reuse Javascript Code Using import
|
||||
title: Reuse JavaScript Code Using import
|
||||
challengeType: 1
|
||||
forumTopicId: 301208
|
||||
---
|
||||
|
@@ -30,10 +30,10 @@ tests:
|
||||
testString: 'assert.strictEqual(truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex"), false);'
|
||||
- text: '<code>truthCheck([{"user": "Tinky-Winky", "sex": "male", "age": 0}, {"user": "Dipsy", "sex": "male", "age": 3}, {"user": "Laa-Laa", "sex": "female", "age": 5}, {"user": "Po", "sex": "female", "age": 4}], "age")</code> should return false.'
|
||||
testString: 'assert.strictEqual(truthCheck([{"user": "Tinky-Winky", "sex": "male", "age": 2}, {"user": "Dipsy", "sex": "male", "age": 0}, {"user": "Laa-Laa", "sex": "female", "age": 5}, {"user": "Po", "sex": "female", "age": 4}], "age"), false);'
|
||||
- text: '<code>truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true}, {"name": "FastFoward", "onBoat": null}], "onBoat")</code> should return false'
|
||||
testString: 'assert.strictEqual(truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true}, {"name": "FastFoward", "onBoat": null}], "onBoat"), false);'
|
||||
- text: '<code>truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true, "alias": "Repete"}, {"name": "FastFoward", "onBoat": true}], "onBoat")</code> should return true'
|
||||
testString: 'assert.strictEqual(truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true, "alias": "Repete"}, {"name": "FastFoward", "onBoat": true}], "onBoat"), true);'
|
||||
- text: '<code>truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true}, {"name": "FastForward", "onBoat": null}], "onBoat")</code> should return false'
|
||||
testString: 'assert.strictEqual(truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true}, {"name": "FastForward", "onBoat": null}], "onBoat"), false);'
|
||||
- text: '<code>truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true, "alias": "Repete"}, {"name": "FastForward", "onBoat": true}], "onBoat")</code> should return true'
|
||||
testString: 'assert.strictEqual(truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true, "alias": "Repete"}, {"name": "FastForward", "onBoat": true}], "onBoat"), true);'
|
||||
- text: '<code>truthCheck([{"single": "yes"}], "single")</code> should return true'
|
||||
testString: 'assert.strictEqual(truthCheck([{"single": "yes"}], "single"), true);'
|
||||
- text: '<code>truthCheck([{"single": ""}, {"single": "double"}], "single")</code> should return false'
|
||||
|
@@ -33,7 +33,7 @@ There are <code>counterReducer()</code> and <code>authReducer()</code> functions
|
||||
```yml
|
||||
tests:
|
||||
- text: The <code>counterReducer</code> should increment and decrement the <code>state</code>.
|
||||
testString: 'assert((function() { const initalState = store.getState().count; store.dispatch({type: INCREMENT}); store.dispatch({type: INCREMENT}); const firstState = store.getState().count; store.dispatch({type: DECREMENT}); const secondState = store.getState().count; return firstState === initalState + 2 && secondState === firstState - 1 })());'
|
||||
testString: 'assert((function() { const initialState = store.getState().count; store.dispatch({type: INCREMENT}); store.dispatch({type: INCREMENT}); const firstState = store.getState().count; store.dispatch({type: DECREMENT}); const secondState = store.getState().count; return firstState === initialState + 2 && secondState === firstState - 1 })());'
|
||||
- text: The <code>authReducer</code> should toggle the <code>state</code> of <code>authenticated</code> between <code>true</code> and <code>false</code>.
|
||||
testString: 'assert((function() { store.dispatch({type: LOGIN}); const loggedIn = store.getState().auth.authenticated; store.dispatch({type: LOGOUT}); const loggedOut = store.getState().auth.authenticated; return loggedIn === true && loggedOut === false })());'
|
||||
- text: 'The store <code>state</code> should have two keys: <code>count</code>, which holds a number, and <code>auth</code>, which holds an object. The <code>auth</code> object should have a property of <code>authenticated</code>, which holds a boolean.'
|
||||
|
@@ -41,8 +41,8 @@ Submit your page when you think you've got it right.
|
||||
tests:
|
||||
- text: Event 'user' should be emitted with name, currentUsers, and connected.
|
||||
testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js') .then(data => { assert.match(data, /io.emit.*('|")user('|").*name.*currentUsers.*connected/gi, 'You should have an event emitted named user sending name, currentUsers, and connected'); }, xhr => { throw new Error(xhr.statusText); })
|
||||
- text: Client should properly handlle and display the new data from event 'user'.
|
||||
testString: "getUserInput => $.get(getUserInput('url')+ '/public/client.js') .then(data => { assert.match(data, /socket.on.*('|\")user('|\")[^]*num-users/gi, 'You should change the text of #num-users within on your client within the \"user\" even listener to show the current users connected'); assert.match(data, /socket.on.*('|\")user('|\")[^]*messages.*li/gi, 'You should append a list item to #messages on your client within the \"user\" event listener to annouce a user came or went'); }, xhr => { throw new Error(xhr.statusText); })"
|
||||
- text: Client should properly handle and display the new data from event 'user'.
|
||||
testString: "getUserInput => $.get(getUserInput('url')+ '/public/client.js') .then(data => { assert.match(data, /socket.on.*('|\")user('|\")[^]*num-users/gi, 'You should change the text of #num-users within on your client within the \"user\" even listener to show the current users connected'); assert.match(data, /socket.on.*('|\")user('|\")[^]*messages.*li/gi, 'You should append a list item to #messages on your client within the \"user\" event listener to announce a user came or went'); }, xhr => { throw new Error(xhr.statusText); })"
|
||||
|
||||
```
|
||||
|
||||
|
@@ -10,7 +10,7 @@ forumTopicId: 301553
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/edit/#!/remix/clone-from-repo?REPO_URL=https://github.com/freeCodeCamp/boilerplate-advancednode/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-advancednode/'>GitHub</a>.
|
||||
Going back to the information security section you may remember that storing plaintext passwords is <em>never</em> okay. Now it is time to implement BCrypt to solve this issue.
|
||||
<hr>Add BCrypt as a dependency and require it in your server. You will need to handle hashing in 2 key areas: where you handle registering/saving a new account and when you check to see that a password is correct on login.
|
||||
Currently on our registeration route, you insert a user's password into the database like the following: <code>password: req.body.password</code>. An easy way to implement saving a hash instead is to add the following before your database logic <code>var hash = bcrypt.hashSync(req.body.password, 12);</code> and replacing the <code>req.body.password</code> in the database saving with just <code>password: hash</code>.
|
||||
Currently on our registration route, you insert a user's password into the database like the following: <code>password: req.body.password</code>. An easy way to implement saving a hash instead is to add the following before your database logic <code>var hash = bcrypt.hashSync(req.body.password, 12);</code> and replacing the <code>req.body.password</code> in the database saving with just <code>password: hash</code>.
|
||||
Finally on our authentication strategy we check for the following in our code before completing the process: <code>if (password !== user.password) { return done(null, false); }</code>. After making the previous changes, now <code>user.password</code> is a hash. Before making a change to the existing code, notice how the statement is checking if the password is NOT equal then return non-authenticated. With this in mind your code could look as follows to properly check the password entered against the hash: <code>if (!bcrypt.compareSync(password, user.password)) { return done(null, false); }</code>
|
||||
That is all it takes to implement one of the most important security features when you have to store passwords! Submit your page when you think you've got it right.
|
||||
</section>
|
||||
|
@@ -36,7 +36,7 @@ Submit your page when you think you've got it right. If you're running into erro
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: Passort and Express-session should be dependencies.
|
||||
- text: Passport and Express-session should be dependencies.
|
||||
testString: getUserInput => $.get(getUserInput('url')+ '/_api/package.json') .then(data => { var packJson = JSON.parse(data); assert.property(packJson.dependencies, 'passport', 'Your project should list "passport" as a dependency'); assert.property(packJson.dependencies, 'express-session', 'Your project should list "express-session" as a dependency'); }, xhr => { throw new Error(xhr.statusText); })
|
||||
- text: Dependencies should be correctly required.
|
||||
testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js') .then(data => { assert.match(data, /require.*("|')passport("|')/gi, 'You should have required passport'); assert.match(data, /require.*("|')express-session("|')/gi, 'You should have required express-session'); }, xhr => { throw new Error(xhr.statusText); })
|
||||
|
@@ -29,7 +29,7 @@ tests:
|
||||
- text: All tests should pass.
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: You should choose the right assertion - isOk vs. isNotOk.
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then(data => { assert.equal(data.assertions[0].method, 'isNotOk', 'Null is falsey'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then(data => { assert.equal(data.assertions[0].method, 'isNotOk', 'Null is falsy'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: You should choose the right assertion - isOk vs. isNotOk.
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then(data => { assert.equal(data.assertions[1].method, 'isOk','A string is truthy'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: You should choose the right assertion - isOk vs. isNotOk.
|
||||
|
@@ -71,12 +71,12 @@ permAlone('aab');
|
||||
|
||||
```js
|
||||
function permAlone(str) {
|
||||
return permutor(str).filter(function(perm) {
|
||||
return permuter(str).filter(function(perm) {
|
||||
return !perm.match(/(.)\1/g);
|
||||
}).length;
|
||||
}
|
||||
|
||||
function permutor(str) {
|
||||
function permuter(str) {
|
||||
// http://staff.roguecc.edu/JMiller/JavaScript/permute.html
|
||||
//permArr: Global array which holds the list of permutations
|
||||
//usedChars: Global utility array which holds a list of "currently-in-use" characters
|
||||
|
@@ -12,7 +12,7 @@ Consider the following two triangles:
|
||||
A(-340,495), B(-153,-910), C(835,-947)
|
||||
X(-175,41), Y(-421,-714), Z(574,-645)
|
||||
It can be verified that triangle ABC contains the origin, whereas triangle XYZ does not.
|
||||
Using triangles.txt (right click and 'Save Link/Target As...'), a 27K text file containing the co-ordinates of one thousand "random" triangles, find the number of triangles for which the interior contains the origin.
|
||||
Using triangles.txt (right click and 'Save Link/Target As...'), a 27K text file containing the coordinates of one thousand "random" triangles, find the number of triangles for which the interior contains the origin.
|
||||
NOTE: The first two examples in the file represent the triangles in the example given above.
|
||||
</section>
|
||||
|
||||
|
@@ -7,7 +7,7 @@ forumTopicId: 301820
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Consider the set Ir of points (x,y) with integer co-ordinates in the interior of the circle with radius r, centered at the origin, i.e. x2 + y2 < r2.
|
||||
Consider the set Ir of points (x,y) with integer coordinates in the interior of the circle with radius r, centered at the origin, i.e. x2 + y2 < r2.
|
||||
For a radius of 2, I2 contains the nine points (0,0), (1,0), (1,1), (0,1), (-1,1), (-1,0), (-1,-1), (0,-1) and (1,-1). There are eight triangles having all three vertices in I2 which contain the origin in the interior. Two of them are shown below, the others are obtained from these by rotation.
|
||||
|
||||
|
||||
|
@@ -7,7 +7,7 @@ forumTopicId: 301928
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Given the values of integers 1 < a1 < a2 <... < an, consider the linear combinationq1a1 + q2a2 + ... + qnan = b, using only integer values qk ≥ 0.
|
||||
Given the values of integers 1 < a1 < a2 <... < an, consider the linear combination q1a1 + q2a2 + ... + qnan = b, using only integer values qk ≥ 0.
|
||||
|
||||
|
||||
Note that for a given set of ak, it may be that not all values of b are possible.
|
||||
|
@@ -12,7 +12,7 @@ There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73
|
||||
How many circular primes are there below n, whereas 100 <= n <= 1000000?
|
||||
|
||||
<br><strong>Note:</strong><br>
|
||||
Circular primes individual rotation can exceeed `n`.
|
||||
Circular primes individual rotation can exceed `n`.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@@ -106,7 +106,7 @@ function circularPrimes(n) {
|
||||
continue;
|
||||
}
|
||||
else if (!primes[x]) {
|
||||
// If the rotated value is 0 then its not a ciruclar prime, break the loop
|
||||
// If the rotated value is 0 then it isn't a circular prime, break the loop
|
||||
tmp = 0;
|
||||
break;
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ Let C<sub>out</sub> be the circle having the diameter WZ.
|
||||
The triplet (<var>a</var>, <var>b</var>, <var>c</var>) is called a <em>necklace triplet</em> if you can place <var>k</var> ≥ 3 distinct circles C<sub>1</sub>, C<sub>2</sub>, ..., C<sub><var>k</var></sub> such that:
|
||||
<ul><li>C<sub><var>i</var></sub> has no common interior points with any C<sub><var>j</var></sub> for 1 ≤ <var>i</var>, <var>j</var> ≤ <var>k</var> and <var>i</var> ≠ <var>j</var>,</li><li>C<sub><var>i</var></sub> is tangent to both C<sub>in</sub> and C<sub>out</sub> for 1 ≤ <var>i</var> ≤ <var>k</var>,</li><li>C<sub><var>i</var></sub> is tangent to C<sub><var>i</var>+1</sub> for 1 ≤ <var>i</var> < <var>k</var>, and</li><li>C<sub><var>k</var></sub> is tangent to C<sub>1</sub>.</li></ul>
|
||||
For example, (5, 5, 5) and (4, 3, 21) are necklace triplets, while it can be shown that (2, 2, 5) is not.
|
||||
<img src="https://projecteuler.net/project/images/p428_necklace.png" alt="a visual reresentation of a necklace triplet">
|
||||
<img src="https://projecteuler.net/project/images/p428_necklace.png" alt="a visual representation of a necklace triplet">
|
||||
|
||||
Let T(<var>n</var>) be the number of necklace triplets (<var>a</var>, <var>b</var>, <var>c</var>) such that <var>a</var>, <var>b</var> and <var>c</var> are positive integers, and <var>b</var> ≤ <var>n</var>.
|
||||
For example, T(1) = 9, T(20) = 732 and T(3000) = 438106.
|
||||
|
@@ -7,12 +7,12 @@ forumTopicId: 302208
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
The points P (x1, y1) and Q (x2, y2) are plotted at integer co-ordinates and are joined to the origin, O(0,0), to form ΔOPQ.
|
||||
The points P (x1, y1) and Q (x2, y2) are plotted at integer coordinates and are joined to the origin, O(0,0), to form ΔOPQ.
|
||||
|
||||
|
||||
|
||||
|
||||
There are exactly fourteen triangles containing a right angle that can be formed when each co-ordinate lies between 0 and 2 inclusive; that is,0 ≤ x1, y1, x2, y2 ≤ 2.
|
||||
There are exactly fourteen triangles containing a right angle that can be formed when each coordinate lies between 0 and 2 inclusive; that is,0 ≤ x1, y1, x2, y2 ≤ 2.
|
||||
|
||||
|
||||
|
||||
|
@@ -37,7 +37,7 @@ Implement a function to determine how many ways there are to make change for a d
|
||||
tests:
|
||||
- text: <code>countCoins</code> should be a function.
|
||||
testString: assert(typeof countCoins === 'function');
|
||||
- text: <code>countCoints()</code> should return 242.
|
||||
- text: <code>countCoins()</code> should return 242.
|
||||
testString: assert.equal(countCoins(), 242);
|
||||
|
||||
```
|
||||
|
@@ -28,13 +28,13 @@ tests:
|
||||
testString: assert(typeof add12Hours('January 17 2017 11:43am EST') === 'string');
|
||||
- text: <code>add12Hours("January 17 2017 11:43am EST")</code> should return <code>"January 17 2017 11:43pm EST"</code>
|
||||
testString: assert(add12Hours('January 17 2017 11:43am EST') === 'January 17 2017 11:43pm EST');
|
||||
- text: Should handel day change. <code>add12Hours("March 7 2009 7:30pm EST")</code> should return <code>"March 8 2009 7:30am EST"</code>
|
||||
- text: Should handle day change. <code>add12Hours("March 7 2009 7:30pm EST")</code> should return <code>"March 8 2009 7:30am EST"</code>
|
||||
testString: assert(add12Hours('March 7 2009 7:30pm EST') === 'March 8 2009 7:30am EST');
|
||||
- text: Should handel month change in a leap years. <code>add12Hours("February 29 2004 9:15pm EST")</code> should return <code>"March 1 2004 9:15am EST"</code>
|
||||
- text: Should handle month change in a leap years. <code>add12Hours("February 29 2004 9:15pm EST")</code> should return <code>"March 1 2004 9:15am EST"</code>
|
||||
testString: assert(add12Hours('February 29 2004 9:15pm EST') === 'March 1 2004 9:15am EST');
|
||||
- text: Should handel month change in a common years. <code>add12Hours("February 28 1999 3:15pm EST")</code> should return <code>"March 1 1999 3:15am EST"</code>
|
||||
- text: Should handle month change in a common years. <code>add12Hours("February 28 1999 3:15pm EST")</code> should return <code>"March 1 1999 3:15am EST"</code>
|
||||
testString: assert(add12Hours('February 28 1999 3:15pm EST') === 'March 1 1999 3:15am EST');
|
||||
- text: Should handel year change. <code>add12Hours("December 31 2020 1:45pm EST")</code> should return <code>"January 1 2021 1:45am EST"</code>
|
||||
- text: Should handle year change. <code>add12Hours("December 31 2020 1:45pm EST")</code> should return <code>"January 1 2021 1:45am EST"</code>
|
||||
testString: assert(add12Hours('December 31 2020 1:45pm EST') === 'January 1 2021 1:45am EST');
|
||||
|
||||
```
|
||||
|
@@ -10,7 +10,7 @@ forumTopicId: 302273
|
||||
Write a generalized version of <a href="https://rosettacode.org/wiki/FizzBuzz" target="_blank">FizzBuzz</a> that works for any list of factors, along with their words.
|
||||
This is basically a "fizzbuzz" implementation where the rules of the game are supplied to the user. Create a function to implement this. The function should take two parameters.
|
||||
The first will be an array with the FizzBuzz rules. For example: <code>[ [3, "Fizz"] , [5, "Buzz"] ]</code>.
|
||||
This indcates that <code>Fizz</code> should be printed if the number is a multiple of 3 and <code>Buzz</code> if it is a multiple of 5. If it is a multiple of both then the strings should be concatenated in the order specified in the array. In this case, <code>FizzBuzz</code> if the number is a multiple of 3 and 5.
|
||||
This indicates that <code>Fizz</code> should be printed if the number is a multiple of 3 and <code>Buzz</code> if it is a multiple of 5. If it is a multiple of both then the strings should be concatenated in the order specified in the array. In this case, <code>FizzBuzz</code> if the number is a multiple of 3 and 5.
|
||||
The second parameter is the number for which the function should return a string as stated above.
|
||||
</section>
|
||||
|
||||
|
@@ -17,7 +17,7 @@ If you already have <i>gcd</i> for <a href="https://rosettacode.org/wiki/great
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Compute the least common multiple of an array of intergers.
|
||||
Compute the least common multiple of an array of integers.
|
||||
Given <i>m</i> and <i>n</i>, the least common multiple is the smallest positive integer that has both <i>m</i> and <i>n</i> as factors.
|
||||
</section>
|
||||
|
||||
|
@@ -32,8 +32,8 @@ tests:
|
||||
testString: assert.deepEqual(lengthSorter(["Mine", "is", "going", "great"]), ["going", "great", "Mine", "is"], '<code>lengthSorter(["Mine", "is", "going", "great"])</code> should return <code>["going", "great", "Mine", "is"]</code>.');
|
||||
- text: <code>lengthSorter(["Have", "fun", "sorting", "!!"])</code> should return <code>["sorting", "Have", "fun", "!!"]</code>.
|
||||
testString: assert.deepEqual(lengthSorter(["Have", "fun", "sorting", "!!"]), ["sorting", "Have", "fun", "!!"], '<code>lengthSorter(["Have", "fun", "sorting", "!!"])</code> should return <code>["sorting", "Have", "fun", "!!"]</code>.');
|
||||
- text: <code>lengthSorter(["Everthing", "is", "good", "!!"])</code> should return <code>["Everthing", "good", "!!", "is"]</code>.
|
||||
testString: assert.deepEqual(lengthSorter(["Everthing", "is", "good", "!!"]), ["Everthing", "good", "!!", "is"], '<code>lengthSorter(["Everthing", "is", "good", "!!"])</code> should return <code>["Everthing", "good", "!!", "is"]</code>.');
|
||||
- text: <code>lengthSorter(["Everything", "is", "good", "!!"])</code> should return <code>["Everything", "good", "!!", "is"]</code>.
|
||||
testString: assert.deepEqual(lengthSorter(["Everything", "is", "good", "!!"]), ["Everything", "good", "!!", "is"], '<code>lengthSorter(["Everything", "is", "good", "!!"])</code> should return <code>["Everything", "good", "!!", "is"]</code>.');
|
||||
```
|
||||
|
||||
</section>
|
||||
|
@@ -7,7 +7,7 @@ forumTopicId: 302318
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Write a function to permform <a href="https://en.wikipedia.org/wiki/Stooge sort" target="_blank">Stooge Sort</a> on an array of integers. The function should return a sorted array.
|
||||
Write a function to perform <a href="https://en.wikipedia.org/wiki/Stooge sort" target="_blank">Stooge Sort</a> on an array of integers. The function should return a sorted array.
|
||||
The Stooge Sort algorithm is as follows:
|
||||
<pre>
|
||||
<b>algorithm</b> stoogesort(<b>array</b> L, i = 0, j = <b>length</b>(L)-1)
|
||||
|
@@ -67,7 +67,7 @@ const text =
|
||||
`Wrap text using a more sophisticated algorithm such as the Knuth and Plass TeX algorithm.
|
||||
If your language provides this, you get easy extra credit,
|
||||
but you ''must reference documentation'' indicating that the algorithm
|
||||
is something better than a simple minimimum length algorithm.`;
|
||||
is something better than a simple minimum length algorithm.`;
|
||||
|
||||
const wrapped80 = wrap(text, 80);
|
||||
const wrapped42 = wrap(text, 42);
|
||||
|
Reference in New Issue
Block a user