chore: fixed typos via client9/misspell (#17081)

This commit is contained in:
Nicholas Nadeau, P.Eng., AVS
2018-04-25 01:07:27 -04:00
committed by mrugesh mohapatra
parent 49a5fdafc2
commit a8efeb50d7
15 changed files with 65 additions and 65 deletions

View File

@ -11,7 +11,7 @@
[ [
"", "",
"", "",
"JavaScript is a high-level programming language that all modern web browsers support. It is also one of the core technologies of the web, along with HTML and CSS that you may have learned previously. This section will cover basic programming concepts in JavaScript, which range from variables and arithemtic to objects and loops.", "JavaScript is a high-level programming language that all modern web browsers support. It is also one of the core technologies of the web, along with HTML and CSS that you may have learned previously. This section will cover basic programming concepts in JavaScript, which range from variables and arithmetic to objects and loops.",
"" ""
] ]
], ],

View File

@ -30,7 +30,7 @@
"One of the biggest problems with declaring variables with the <code>var</code> keyword is that you can overwrite variable declarations without an error.", "One of the biggest problems with declaring variables with the <code>var</code> keyword is that you can overwrite variable declarations without an error.",
"<blockquote>var camper = 'James';<br>var camper = 'David';<br>console.log(camper);<br>// logs 'David'</blockquote>", "<blockquote>var camper = 'James';<br>var camper = 'David';<br>console.log(camper);<br>// logs 'David'</blockquote>",
"As you can see in the code above, the <code>camper</code> variable is originally declared as <code>James</code> and then overridden to be <code>David</code>.", "As you can see in the code above, the <code>camper</code> variable is originally declared as <code>James</code> and then overridden to be <code>David</code>.",
"In a small application, you might not run into this type of problem, but when your code becomes larger, you might accidently overwrite a variable that you did not intend to overwrite.", "In a small application, you might not run into this type of problem, but when your code becomes larger, you might accidentally overwrite a variable that you did not intend to overwrite.",
"Because this behavior does not throw an error, searching and fixing bugs becomes more difficult.<br>", "Because this behavior does not throw an error, searching and fixing bugs becomes more difficult.<br>",
"A new keyword called <code>let</code> was introduced in ES6 to solve this potential issue with the <code>var</code> keyword.", "A new keyword called <code>let</code> was introduced in ES6 to solve this potential issue with the <code>var</code> keyword.",
"If you were to replace <code>var</code> with <code>let</code> in the variable declarations of the code above, the result would be an error.", "If you were to replace <code>var</code> with <code>let</code> in the variable declarations of the code above, the result would be an error.",
@ -72,7 +72,7 @@
"The <code>let</code> keyword behaves similarly, but with some extra features. When you declare a variable with the <code>let</code> keyword inside a block, statement, or expression, its scope is limited to that block, statement, or expression.", "The <code>let</code> keyword behaves similarly, but with some extra features. When you declare a variable with the <code>let</code> keyword inside a block, statement, or expression, its scope is limited to that block, statement, or expression.",
"For example:", "For example:",
"<blockquote>var numArray = [];<br>for (var i = 0; i < 3; i++) {<br> numArray.push(i);<br>}<br>console.log(numArray);<br>// returns [0, 1, 2]<br>console.log(i);<br>// returns 3</blockquote>", "<blockquote>var numArray = [];<br>for (var i = 0; i < 3; i++) {<br> numArray.push(i);<br>}<br>console.log(numArray);<br>// returns [0, 1, 2]<br>console.log(i);<br>// returns 3</blockquote>",
"With the <code>var</code> keyword, <code>i</code> is declared globally. So when <code>i++</code> is executed, it updates the global variable. This code is similiar to the following:", "With the <code>var</code> keyword, <code>i</code> is declared globally. So when <code>i++</code> is executed, it updates the global variable. This code is similar to the following:",
"<blockquote>var numArray = [];<br>var i;<br>for (i = 0; i < 3; i++) {<br> numArray.push(i);<br>}<br>console.log(numArray);<br>// returns [0, 1, 2]<br>console.log(i);<br>// returns 3</blockquote>", "<blockquote>var numArray = [];<br>var i;<br>for (i = 0; i < 3; i++) {<br> numArray.push(i);<br>}<br>console.log(numArray);<br>// returns [0, 1, 2]<br>console.log(i);<br>// returns 3</blockquote>",
"This behavior will cause problems if you were to create a function and store it for later use inside a for loop that uses the <code>i</code> variable. This is because the stored function will always refer to the value of the updated global <code>i</code> variable.", "This behavior will cause problems if you were to create a function and store it for later use inside a for loop that uses the <code>i</code> variable. This is because the stored function will always refer to the value of the updated global <code>i</code> variable.",
"<blockquote>var printNumTwo;<br>for (var i = 0; i < 3; i++) {<br> if(i === 2){<br> printNumTwo = function() {<br> return i;<br> };<br> }<br>}<br>console.log(printNumTwo());<br>// returns 3</blockquote>", "<blockquote>var printNumTwo;<br>for (var i = 0; i < 3; i++) {<br> if(i === 2){<br> printNumTwo = function() {<br> return i;<br> };<br> }<br>}<br>console.log(printNumTwo());<br>// returns 3</blockquote>",
@ -541,7 +541,7 @@
"Variables <code>a</code> and <code>b</code> take the first and second values from the array. After that, because of rest operator's presence, <code>arr</code> gets rest of the values in the form of an array.", "Variables <code>a</code> and <code>b</code> take the first and second values from the array. After that, because of rest operator's presence, <code>arr</code> gets rest of the values in the form of an array.",
"The rest element only works correctly as the last variable in the list. As in, you cannot use the rest operator to catch a subarray that leaves out last element of the original array.", "The rest element only works correctly as the last variable in the list. As in, you cannot use the rest operator to catch a subarray that leaves out last element of the original array.",
"<hr>", "<hr>",
"Use destructuring assignment with the rest operator to perform an effective <code>Array.prototype.slice()</code> so that <code>arr</code> is a sub-array of the original array <code>source</code> with the first two elements ommitted." "Use destructuring assignment with the rest operator to perform an effective <code>Array.prototype.slice()</code> so that <code>arr</code> is a sub-array of the original array <code>source</code> with the first two elements omitted."
], ],
"challengeSeed": [ "challengeSeed": [
"const source = [1,2,3,4,5,6,7,8,9,10];", "const source = [1,2,3,4,5,6,7,8,9,10];",
@ -823,7 +823,7 @@
"There are a few ways to write an <code>import</code> statement, but the above is a very common use-case.", "There are a few ways to write an <code>import</code> statement, but the above is a very common use-case.",
"<strong>Note</strong><br>The whitespace surrounding the function inside the curly braces is a best practice - it makes it easier to read the <code>import</code> statement.", "<strong>Note</strong><br>The whitespace surrounding the function inside the curly braces is a best practice - it makes it easier to read the <code>import</code> statement.",
"<strong>Note</strong><br>The lessons in this section handle non-browser features. <code>import</code>, and the statements we introduce in the rest of these lessons, won't work on a browser directly. However, we can use various tools to create code out of this to make it work in browser.", "<strong>Note</strong><br>The lessons in this section handle non-browser features. <code>import</code>, and the statements we introduce in the rest of these lessons, won't work on a browser directly. However, we can use various tools to create code out of this to make it work in browser.",
"<strong>Note</strong><br>In most cases, the file path requires a <code>./</code> before it; otherwise, node will look in the <code>node_modules</code> directory first trying to load it as a dependencie.", "<strong>Note</strong><br>In most cases, the file path requires a <code>./</code> before it; otherwise, node will look in the <code>node_modules</code> directory first trying to load it as a dependency.",
"<hr>", "<hr>",
"Add the appropriate <code>import</code> statement that will allow the current file to use the <code>capitalizeString</code> function. The file where this function lives is called <code>\"string_functions\"</code>, and it is in the same directory as the current file." "Add the appropriate <code>import</code> statement that will allow the current file to use the <code>capitalizeString</code> function. The file where this function lives is called <code>\"string_functions\"</code>, and it is in the same directory as the current file."
], ],

View File

@ -1173,7 +1173,7 @@
"tests": [ "tests": [
"assert((function() { const mockedComponent = Enzyme.mount(React.createElement(StatefulComponent)); return mockedComponent.find('StatefulComponent').length === 1; })(), 'message: <code>StatefulComponent</code> should exist and render.');", "assert((function() { const mockedComponent = Enzyme.mount(React.createElement(StatefulComponent)); return mockedComponent.find('StatefulComponent').length === 1; })(), 'message: <code>StatefulComponent</code> should exist and render.');",
"assert((function() { const mockedComponent = Enzyme.mount(React.createElement(StatefulComponent)); return mockedComponent.find('div').length === 1 && mockedComponent.find('h1').length === 1; })(), 'message: <code>StatefulComponent</code> should render a <code>div</code> and an <code>h1</code> element.');", "assert((function() { const mockedComponent = Enzyme.mount(React.createElement(StatefulComponent)); return mockedComponent.find('div').length === 1 && mockedComponent.find('h1').length === 1; })(), 'message: <code>StatefulComponent</code> should render a <code>div</code> and an <code>h1</code> element.');",
"assert((function() { const mockedComponent = Enzyme.mount(React.createElement(StatefulComponent)); const initialState = mockedComponent.state(); return ( typeof initialState === 'object' && typeof initialState.name === 'string'); })(), 'message: The state of <code>StatefulComponent</code> should be initalized with a property <code>name</code> set to a string.');", "assert((function() { const mockedComponent = Enzyme.mount(React.createElement(StatefulComponent)); const initialState = mockedComponent.state(); return ( typeof initialState === 'object' && typeof initialState.name === 'string'); })(), 'message: The state of <code>StatefulComponent</code> should be initialized with a property <code>name</code> set to a string.');",
"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.');" "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": [ "solutions": [

View File

@ -9,7 +9,7 @@
"title": "Timestamp Microservice", "title": "Timestamp Microservice",
"description": [ "description": [
"Build a full stack JavaScript app that is functionally similar to this: <a href='https://curse-arrow.glitch.me/' target='_blank'>https://curse-arrow.glitch.me/</a>.", "Build a full stack JavaScript app that is functionally similar to this: <a href='https://curse-arrow.glitch.me/' target='_blank'>https://curse-arrow.glitch.me/</a>.",
"Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicaly visible for our testing.", "Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.",
"Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-timestamp/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-timestamp/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!" "Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-timestamp/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-timestamp/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!"
], ],
"challengeSeed": [], "challengeSeed": [],
@ -43,7 +43,7 @@
"title": "Request Header Parser Microservice", "title": "Request Header Parser Microservice",
"description": [ "description": [
"Build a full stack JavaScript app that is functionally similar to this: <a href='https://dandelion-roar.glitch.me/' target='_blank'>https://dandelion-roar.glitch.me/</a>.", "Build a full stack JavaScript app that is functionally similar to this: <a href='https://dandelion-roar.glitch.me/' target='_blank'>https://dandelion-roar.glitch.me/</a>.",
"Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicaly visible for our testing.", "Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.",
"Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-headerparser/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-headerparser/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!" "Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-headerparser/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-headerparser/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!"
], ],
"challengeSeed": [], "challengeSeed": [],
@ -69,7 +69,7 @@
"title": "URL Shortener Microservice", "title": "URL Shortener Microservice",
"description": [ "description": [
"Build a full stack JavaScript app that is functionally similar to this: <a href='https://thread-paper.glitch.me/' target='_blank'>https://thread-paper.glitch.me/</a>.", "Build a full stack JavaScript app that is functionally similar to this: <a href='https://thread-paper.glitch.me/' target='_blank'>https://thread-paper.glitch.me/</a>.",
"Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicaly visible for our testing.", "Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.",
"Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-urlshortener/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-urlshortener/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!" "Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-urlshortener/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-urlshortener/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!"
], ],
"challengeSeed": [], "challengeSeed": [],
@ -103,7 +103,7 @@
"title": "Exercise Tracker", "title": "Exercise Tracker",
"description": [ "description": [
"Build a full stack JavaScript app that is functionally similar to this: <a href='https://fuschia-custard.glitch.me/' target='_blank'>https://fuschia-custard.glitch.me/</a>.", "Build a full stack JavaScript app that is functionally similar to this: <a href='https://fuschia-custard.glitch.me/' target='_blank'>https://fuschia-custard.glitch.me/</a>.",
"Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicaly visible for our testing.", "Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.",
"Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-exercisetracker/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-exercisetracker/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!" "Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-exercisetracker/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-exercisetracker/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!"
], ],
"challengeSeed": [], "challengeSeed": [],
@ -145,7 +145,7 @@
"title": "File Metadata Microservice", "title": "File Metadata Microservice",
"description": [ "description": [
"Build a full stack JavaScript app that is functionally similar to this: <a href='https://purple-paladin.glitch.me/' target='_blank'>https://purple-paladin.glitch.me/</a>.", "Build a full stack JavaScript app that is functionally similar to this: <a href='https://purple-paladin.glitch.me/' target='_blank'>https://purple-paladin.glitch.me/</a>.",
"Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicaly visible for our testing.", "Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.",
"Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-filemetadata/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-filemetadata/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!" "Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-filemetadata/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-filemetadata/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!"
], ],
"challengeSeed": [], "challengeSeed": [],

View File

@ -285,7 +285,7 @@
"Mount a POST handler at the path <code>/name</code>. Its the same path as before. We have prepared a form in the html frontpage. It will submit the same data of exercise 10 (Query string). If the body-parser is configured correctly, you should find the parameters in the object <code>req.body</code>. Have a look at the usual library example:", "Mount a POST handler at the path <code>/name</code>. Its the same path as before. We have prepared a form in the html frontpage. It will submit the same data of exercise 10 (Query string). If the body-parser is configured correctly, you should find the parameters in the object <code>req.body</code>. Have a look at the usual library example:",
"<blockquote>route: POST '/library'<br>urlencoded_body: userId=546&bookId=6754 <br>req.body: {userId: '546', bookId: '6754'}</blockquote>", "<blockquote>route: POST '/library'<br>urlencoded_body: userId=546&bookId=6754 <br>req.body: {userId: '546', bookId: '6754'}</blockquote>",
"Respond with the same JSON object as before: <code>{name: 'firstname lastname'}</code>. Test if your endpoint works using the html form we provided in the app frontpage.", "Respond with the same JSON object as before: <code>{name: 'firstname lastname'}</code>. Test if your endpoint works using the html form we provided in the app frontpage.",
"Tip: There are several other http methods other than GET and POST. And by convention there is a corrispondence between the http verb, and the operation you are going to execute on the server. The conventional mapping is:", "Tip: There are several other http methods other than GET and POST. And by convention there is a correspondence between the http verb, and the operation you are going to execute on the server. The conventional mapping is:",
"POST (sometimes PUT) - Create a new resource using the information sent with the request,", "POST (sometimes PUT) - Create a new resource using the information sent with the request,",
"GET - Read an existing resource without modifying it,", "GET - Read an existing resource without modifying it,",
"PUT or PATCH (sometimes POST) - Update a resource using the data sent,", "PUT or PATCH (sometimes POST) - Update a resource using the data sent,",

View File

@ -17,7 +17,7 @@
[ [
"", "",
"", "",
"Working on these challenges will involve you writing your code on Glitch on our starter project. After completing each challenge you can copy your public glitch url (to the homepage of your app) into the challenge screen to test it! Optionally you may choose to write your project on another platform but it must be publicaly visible for our testing.<br>Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mongomongoose/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-mongomongoose/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!", "Working on these challenges will involve you writing your code on Glitch on our starter project. After completing each challenge you can copy your public glitch url (to the homepage of your app) into the challenge screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.<br>Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mongomongoose/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-mongomongoose/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!",
"" ""
] ]
], ],

View File

@ -11,7 +11,7 @@
[ [
"", "",
"", "",
"<em>Authentication</em> is the process or action of verifying the identity of a user or process. Up to this point you have not been able to create an app utilizing this key concept.<br>The most common and easiest to use authentication middleware for Node.js is <a href='http://passportjs.org/'>Passport</a>. It is easy to learn, light-weight, and extremely flexible allowing for many <em>strategies</em>, which we will talk about in later challenges. In addition to authentication we will also look at template engines which allow for use of <em>Pug</em> and web sockets which allow for real time communication between all your clients and your server. Working on these challenges will involve you writing your code on Glitch on our starter project. After completing each challenge you can copy your public glitch url (to the homepage of your app) into the challenge screen to test it! Optionally you may choose to write your project on another platform but it must be publicaly visible for our testing.<br>Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-advancednode/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-advancednode/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!", "<em>Authentication</em> is the process or action of verifying the identity of a user or process. Up to this point you have not been able to create an app utilizing this key concept.<br>The most common and easiest to use authentication middleware for Node.js is <a href='http://passportjs.org/'>Passport</a>. It is easy to learn, light-weight, and extremely flexible allowing for many <em>strategies</em>, which we will talk about in later challenges. In addition to authentication we will also look at template engines which allow for use of <em>Pug</em> and web sockets which allow for real time communication between all your clients and your server. Working on these challenges will involve you writing your code on Glitch on our starter project. After completing each challenge you can copy your public glitch url (to the homepage of your app) into the challenge screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.<br>Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-advancednode/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-advancednode/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!",
"" ""
] ]
], ],
@ -65,7 +65,7 @@
"Looking at our pug file 'index.pug' included in your project, we used the variables <em>title</em> and <em>message</em>", "Looking at our pug file 'index.pug' included in your project, we used the variables <em>title</em> and <em>message</em>",
"To pass those alone from our server, you will need to add an object as a second argument to your <em>res.render</em> with the variables and their value. For example, pass this object along setting the variables for your index view: <code>{title: 'Hello', message: 'Please login'</code>", "To pass those alone from our server, you will need to add an object as a second argument to your <em>res.render</em> with the variables and their value. For example, pass this object along setting the variables for your index view: <code>{title: 'Hello', message: 'Please login'</code>",
"It should look like: <code>res.render(process.cwd() + '/views/pug/index', {title: 'Hello', message: 'Please login'});</code>", "It should look like: <code>res.render(process.cwd() + '/views/pug/index', {title: 'Hello', message: 'Please login'});</code>",
"Now refresh your page and you should see those values rendered in your view in the correct spot as layed out in your index.pug file! Submit your page when you think you've got it right." "Now refresh your page and you should see those values rendered in your view in the correct spot as laid out in your index.pug file! Submit your page when you think you've got it right."
], ],
"challengeSeed": [], "challengeSeed": [],
"tests": [ "tests": [
@ -514,7 +514,7 @@
[ [
"", "",
"", "",
"<dfn>Socket.IO</dfn> enables real-time, reliable, speedy communication between your server and clients from all devices and browsers. It listens for connects on your server that come from the client which connects with a single javascript statement. The whole library is based on emitting, broadcasting, and recieving events that contain an event name and some data which can include things like strings, objects, arrays, and even blobs like files or video. This is used for all sorts of purposes including instant messaging online, real-time analytics, streaming, and document collaboration.<br>Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-socketio/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-socketio/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe.", "<dfn>Socket.IO</dfn> enables real-time, reliable, speedy communication between your server and clients from all devices and browsers. It listens for connects on your server that come from the client which connects with a single javascript statement. The whole library is based on emitting, broadcasting, and receiving events that contain an event name and some data which can include things like strings, objects, arrays, and even blobs like files or video. This is used for all sorts of purposes including instant messaging online, real-time analytics, streaming, and document collaboration.<br>Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-socketio/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-socketio/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe.",
"" ""
], ],
[ [
@ -539,13 +539,13 @@
}, },
{ {
"id": "589fc830f9fc0f352b528e74", "id": "589fc830f9fc0f352b528e74",
"title": "Set up the Enviroment", "title": "Set up the Environment",
"description": [ "description": [
"As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-socketio/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-socketio/'>GitHub</a>.", "As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-socketio/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-socketio/'>GitHub</a>.",
"Add Socket.IO as a dependency and require/instanciate it in your server defined as 'io' with the http server as an argument. <code>const io = require('socket.io')(http);</code>", "Add Socket.IO as a dependency and require/instantiate it in your server defined as 'io' with the http server as an argument. <code>const io = require('socket.io')(http);</code>",
"The first thing needing to be handled is listening for a new connection from the client. The <dfn>on</dfn> keyword does just that- listen for a specific event. It requires 2 arguments: a string containing the title of the event thats emitted, and a function with which the data is passed though. In the case of our connection listener, we use <em>socket</em> to define the data in the second argument. A socket is an individual client who is connected.", "The first thing needing to be handled is listening for a new connection from the client. The <dfn>on</dfn> keyword does just that- listen for a specific event. It requires 2 arguments: a string containing the title of the event thats emitted, and a function with which the data is passed though. In the case of our connection listener, we use <em>socket</em> to define the data in the second argument. A socket is an individual client who is connected.",
"For listening for connections on our server, add the following between the comments in your project:<pre>io.on('connection', socket => {\n console.log('A user has connected');\n});</pre>", "For listening for connections on our server, add the following between the comments in your project:<pre>io.on('connection', socket => {\n console.log('A user has connected');\n});</pre>",
"Now for the client to connect, you just need to add the following to your client.js which is loaded by the page after you've authenticated: <pre>/*global io*/\nvar socket = io();</pre>The comment supresses the error you would normally see since 'io' is not defined in the file. We've already added a reliable CDN to the Socket.IO library on the page in chat.pug.", "Now for the client to connect, you just need to add the following to your client.js which is loaded by the page after you've authenticated: <pre>/*global io*/\nvar socket = io();</pre>The comment suppresses the error you would normally see since 'io' is not defined in the file. We've already added a reliable CDN to the Socket.IO library on the page in chat.pug.",
"Now try loading up your app and authenticate and you should see in your server console 'A user has connected'!", "Now try loading up your app and authenticate and you should see in your server console 'A user has connected'!",
"<strong>Note</strong><br><code>io()</code> works only when connecting to a socket hosted on the same url/server. For connecting to an external socket hosted elsewhere, you would use <code>io.connect('URL');</code>.", "<strong>Note</strong><br><code>io()</code> works only when connecting to a socket hosted on the same url/server. For connecting to an external socket hosted elsewhere, you would use <code>io.connect('URL');</code>.",
"Submit your page when you think you've got it right." "Submit your page when you think you've got it right."
@ -558,7 +558,7 @@
}, },
{ {
"text": "Socket.IO has been properly required and instanciated", "text": "Socket.IO has been properly required and instanciated",
"testString": "getUserInput => $.get(getUserInput('url')+ '/_api/server.js').then(data => {assert.match(data, /io.*=.*require.*('|\")socket.io('|\").*http/gi, 'You should correctly require and instanciate socket.io as io.');}, xhr => { throw new Error(xhr.statusText); })" "testString": "getUserInput => $.get(getUserInput('url')+ '/_api/server.js').then(data => {assert.match(data, /io.*=.*require.*('|\")socket.io('|\").*http/gi, 'You should correctly require and instantiate socket.io as io.');}, xhr => { throw new Error(xhr.statusText); })"
}, },
{ {
"text": "Socket.IO should be listening for connections", "text": "Socket.IO should be listening for connections",
@ -579,9 +579,9 @@
"title": "Communicate by Emitting", "title": "Communicate by Emitting",
"description": [ "description": [
"As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-socketio/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-socketio/'>GitHub</a>.", "As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-socketio/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-socketio/'>GitHub</a>.",
"<dfn>Emit</dfn> is the most common way of communicating you will use. When you emit something from the server to 'io', you send an event's name and data to all the connected sockets. A good example of this concept would be emiting the current count of connected users each time a new user connects!", "<dfn>Emit</dfn> is the most common way of communicating you will use. When you emit something from the server to 'io', you send an event's name and data to all the connected sockets. A good example of this concept would be emitting the current count of connected users each time a new user connects!",
"<hr>Start by adding a variable to keep track of the users just before where you are currently listening for connections. <code>var currentUsers = 0;</code>", "<hr>Start by adding a variable to keep track of the users just before where you are currently listening for connections. <code>var currentUsers = 0;</code>",
"Now when someone connects you should increment the count before emiting the count so you will want to add the incrementer within the connection listener. <code>++currentUsers;</code>", "Now when someone connects you should increment the count before emitting the count so you will want to add the incrementer within the connection listener. <code>++currentUsers;</code>",
"Finally after incrementing the count, you should emit the event(still within the connection listener). The event should be named 'user count' and the data should just be the 'currentUsers'. <code>io.emit('user count', currentUsers);</code>", "Finally after incrementing the count, you should emit the event(still within the connection listener). The event should be named 'user count' and the data should just be the 'currentUsers'. <code>io.emit('user count', currentUsers);</code>",
"<hr>Now you can implement a way for your client to listen for this event! Similarly to listening for a connection on the server you will use the <em>on</em> keyword. <pre>socket.on('user count', function(data){\n console.log(data);\n});</pre>", "<hr>Now you can implement a way for your client to listen for this event! Similarly to listening for a connection on the server you will use the <em>on</em> keyword. <pre>socket.on('user count', function(data){\n console.log(data);\n});</pre>",
"Now try loading up your app and authenticate and you should see in your client console '1' representing the current user count! Try loading more clients up and authenticating to see the number go up.", "Now try loading up your app and authenticate and you should see in your client console '1' representing the current user count! Try loading more clients up and authenticating to see the number go up.",
@ -642,7 +642,7 @@
"Currently, you cannot determine who is connected to your web socket. While 'req.user' containers the user object, thats only when your user interacts with the web server and with web sockets you have no req (request) and therefor no user data. One way to solve the problem of knowing who is connected to your web socket is by parsing and decoding the cookie that contains the passport session then deserializing it to obtain the user object. Luckily, there is a package on NPM just for this that turns a once complex task into something simple!", "Currently, you cannot determine who is connected to your web socket. While 'req.user' containers the user object, thats only when your user interacts with the web server and with web sockets you have no req (request) and therefor no user data. One way to solve the problem of knowing who is connected to your web socket is by parsing and decoding the cookie that contains the passport session then deserializing it to obtain the user object. Luckily, there is a package on NPM just for this that turns a once complex task into something simple!",
"<hr>Add 'passport.socketio' as a dependency and require it as 'passportSocketIo'.", "<hr>Add 'passport.socketio' as a dependency and require it as 'passportSocketIo'.",
"Now we just have to tell Socket.IO to use it and set the options. Be sure this is added before the existing socket code and not in the existing connection listener. For your server it should look as follows:<pre>io.use(passportSocketIo.authorize({\n cookieParser: cookieParser,\n key: 'express.sid',\n secret: process.env.SESSION_SECRET,\n store: sessionStore\n}));</pre>You can also optionally pass 'success' and 'fail' with a function that will be called after the authentication process completes when a client trys to connect.", "Now we just have to tell Socket.IO to use it and set the options. Be sure this is added before the existing socket code and not in the existing connection listener. For your server it should look as follows:<pre>io.use(passportSocketIo.authorize({\n cookieParser: cookieParser,\n key: 'express.sid',\n secret: process.env.SESSION_SECRET,\n store: sessionStore\n}));</pre>You can also optionally pass 'success' and 'fail' with a function that will be called after the authentication process completes when a client trys to connect.",
"The user object is now accessable on your socket object as <code>socket.request.user</code>. For example, now you can add the following: <code>console.log('user ' + socket.request.user.name + ' connected');</code> and it will log to the server console who has connected!", "The user object is now accessible on your socket object as <code>socket.request.user</code>. For example, now you can add the following: <code>console.log('user ' + socket.request.user.name + ' connected');</code> and it will log to the server console who has connected!",
"Submit your page when you think you've got it right. If you're running into errors, you can check out the project up to this point <a href='https://gist.github.com/JosephLivengood/a9e69ff91337500d5171e29324e1ff35'>here</a>." "Submit your page when you think you've got it right. If you're running into errors, you can check out the project up to this point <a href='https://gist.github.com/JosephLivengood/a9e69ff91337500d5171e29324e1ff35'>here</a>."
], ],
"challengeSeed": [], "challengeSeed": [],
@ -653,7 +653,7 @@
}, },
{ {
"text": "passportSocketIo is properly required", "text": "passportSocketIo is properly required",
"testString": "getUserInput => $.get(getUserInput('url')+ '/_api/server.js').then(data => {assert.match(data, /passportSockerIo.*=.*require.*('|\")passportSocketIo('|\")/gi, 'You should correctly require and instanciate socket.io as io.');}, xhr => { throw new Error(xhr.statusText); })" "testString": "getUserInput => $.get(getUserInput('url')+ '/_api/server.js').then(data => {assert.match(data, /passportSockerIo.*=.*require.*('|\")passportSocketIo('|\")/gi, 'You should correctly require and instantiate socket.io as io.');}, xhr => { throw new Error(xhr.statusText); })"
}, },
{ {
"text": "passportSocketIo is properly setup", "text": "passportSocketIo is properly setup",
@ -699,8 +699,8 @@
"As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-socketio/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-socketio/'>GitHub</a>.", "As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-socketio/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-socketio/'>GitHub</a>.",
"It's time you start allowing clients to send a chat message to the server to emit to all the clients! Already in your client.js file you should see there is already a block of code handling when the messgae form is submitted! (<code>$('form').submit(function(){ /*logic*/ });</code>)", "It's time you start allowing clients to send a chat message to the server to emit to all the clients! Already in your client.js file you should see there is already a block of code handling when the messgae form is submitted! (<code>$('form').submit(function(){ /*logic*/ });</code>)",
"<hr>Within the code you're handling the form submit you should emit an event after you define 'messageToSend' but before you clear the text box <code>#m</code>. The event should be named 'chat message' and the data should just be 'messageToSend'. <code>socket.emit('chat message', messageToSend);</code>", "<hr>Within the code you're handling the form submit you should emit an event after you define 'messageToSend' but before you clear the text box <code>#m</code>. The event should be named 'chat message' and the data should just be 'messageToSend'. <code>socket.emit('chat message', messageToSend);</code>",
"Now on your server you should be listening to the socket for the event 'chat message' with the data being named 'message'. Once the event is recieved it should then emit the event 'chat message' to all sockets <code>io.emit</code> with the data being an object containing 'name' and 'message'.", "Now on your server you should be listening to the socket for the event 'chat message' with the data being named 'message'. Once the event is received it should then emit the event 'chat message' to all sockets <code>io.emit</code> with the data being an object containing 'name' and 'message'.",
"On your client now again, you should now listen for event 'chat message' and when recieved, append a list item to <code>#messages</code> with the name a colon and the message!", "On your client now again, you should now listen for event 'chat message' and when received, append a list item to <code>#messages</code> with the name a colon and the message!",
"At this point the chat should be fully functional and sending messages across all clients! Submit your page when you think you've got it right. If you're running into errors, you can check out the project up to this point <a href='https://gist.github.com/JosephLivengood/3e4b7750f6cd42feaa2768458d682136'>here for the server</a> and <a href='https://gist.github.com/JosephLivengood/41ba76348df3013b7870dc64861de744'>here for the client</a>." "At this point the chat should be fully functional and sending messages across all clients! Submit your page when you think you've got it right. If you're running into errors, you can check out the project up to this point <a href='https://gist.github.com/JosephLivengood/3e4b7750f6cd42feaa2768458d682136'>here for the server</a> and <a href='https://gist.github.com/JosephLivengood/41ba76348df3013b7870dc64861de744'>here for the client</a>."
], ],
"challengeSeed": [], "challengeSeed": [],

View File

@ -11,7 +11,7 @@
[ [
"", "",
"", "",
"HelmetJS is a type of middleware for Express-based applications that automatically sets HTTP headers to prevent sensitive information from unintentially being passed between the server and client. While HelmetJS does not account for all situations, it does include support for common ones like Content Security Policy, XSS Filtering, and HTTP Strict Transport Security, among others. HelmetJS can be installed on an Express project from npm, after which each layer of protection can be configured to best fit the project.<br><br>Working on these challenges will involve you writing your code on Glitch on our starter project. After completing each challenge you can copy your public glitch url (to the homepage of your app) into the challenge screen to test it! Optionally you may choose to write your project on another platform but it must be publicaly visible for our testing.<br>Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-infosec/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-infosec/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!", "HelmetJS is a type of middleware for Express-based applications that automatically sets HTTP headers to prevent sensitive information from unintentially being passed between the server and client. While HelmetJS does not account for all situations, it does include support for common ones like Content Security Policy, XSS Filtering, and HTTP Strict Transport Security, among others. HelmetJS can be installed on an Express project from npm, after which each layer of protection can be configured to best fit the project.<br><br>Working on these challenges will involve you writing your code on Glitch on our starter project. After completing each challenge you can copy your public glitch url (to the homepage of your app) into the challenge screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.<br>Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-infosec/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-infosec/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!",
"" ""
] ]
], ],
@ -314,7 +314,7 @@
}, },
{ {
"text": "BCrypt has been properly required", "text": "BCrypt has been properly required",
"testString": "getUserInput => $.get(getUserInput('url')+ '/_api/server.js').then(data => {assert.match(data, /bcrypt.*=.*require.*('|\")bcrypt('|\")/gi, 'You should correctly require and instanciate socket.io as io.');}, xhr => { throw new Error(xhr.statusText); })" "testString": "getUserInput => $.get(getUserInput('url')+ '/_api/server.js').then(data => {assert.match(data, /bcrypt.*=.*require.*('|\")bcrypt('|\")/gi, 'You should correctly require and instantiate socket.io as io.');}, xhr => { throw new Error(xhr.statusText); })"
} }
], ],
"solutions": [], "solutions": [],

View File

@ -9,7 +9,7 @@
"title": "Metric-Imperial Converter", "title": "Metric-Imperial Converter",
"description": [ "description": [
"Build a full stack JavaScript app that is functionally similar to this: <a href='https://hard-twilight.glitch.me/' target='_blank'>https://hard-twilight.glitch.me/</a>.", "Build a full stack JavaScript app that is functionally similar to this: <a href='https://hard-twilight.glitch.me/' target='_blank'>https://hard-twilight.glitch.me/</a>.",
"Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicaly visible for our testing.", "Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.",
"Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-metricimpconverter/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-metricimpconverter/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!" "Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-metricimpconverter/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-metricimpconverter/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!"
], ],
"challengeSeed": [], "challengeSeed": [],
@ -79,7 +79,7 @@
"title": "Issue Tracker", "title": "Issue Tracker",
"description": [ "description": [
"Build a full stack JavaScript app that is functionally similar to this: <a href='https://protective-garage.glitch.me/' target='_blank'>https://protective-garage.glitch.me/</a>.", "Build a full stack JavaScript app that is functionally similar to this: <a href='https://protective-garage.glitch.me/' target='_blank'>https://protective-garage.glitch.me/</a>.",
"Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicaly visible for our testing.", "Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.",
"Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-issuetracker/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-issuetracker/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!" "Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-issuetracker/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-issuetracker/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!"
], ],
"challengeSeed": [], "challengeSeed": [],
@ -129,7 +129,7 @@
"title": "Personal Library", "title": "Personal Library",
"description": [ "description": [
"Build a full stack JavaScript app that is functionally similar to this: <a href='https://spark-cathedral.glitch.me/' target='_blank'>https://spark-cathedral.glitch.me/</a>.", "Build a full stack JavaScript app that is functionally similar to this: <a href='https://spark-cathedral.glitch.me/' target='_blank'>https://spark-cathedral.glitch.me/</a>.",
"Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but must be publicaly visible for our testing.", "Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but must be publicly visible for our testing.",
"Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-library/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-library/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!" "Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-library/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-library/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!"
], ],
"challengeSeed": [], "challengeSeed": [],
@ -187,7 +187,7 @@
"title": "Stock Price Checker", "title": "Stock Price Checker",
"description": [ "description": [
"Build a full stack JavaScript app that is functionally similar to this: <a href='https://giant-chronometer.glitch.me/' target='_blank'>https://giant-chronometer.glitch.me/</a>.", "Build a full stack JavaScript app that is functionally similar to this: <a href='https://giant-chronometer.glitch.me/' target='_blank'>https://giant-chronometer.glitch.me/</a>.",
"Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but must be publicaly visible for our testing.", "Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but must be publicly visible for our testing.",
"Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-stockchecker/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-stockchecker/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!" "Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-stockchecker/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-stockchecker/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!"
], ],
"challengeSeed": [], "challengeSeed": [],
@ -197,7 +197,7 @@
"testString": "" "testString": ""
}, },
{ {
"text": "I can GET /api/stock-prices with form data containing a Nasdaq stock ticker and recieve back an object stockData.", "text": "I can GET /api/stock-prices with form data containing a Nasdaq stock ticker and receive back an object stockData.",
"testString": "" "testString": ""
}, },
{ {
@ -233,7 +233,7 @@
"title": "Anonymous Message Board", "title": "Anonymous Message Board",
"description": [ "description": [
"Build a full stack JavaScript app that is functionally similar to this: <a href='https://horn-celery.glitch.me/' target='_blank'>https://horn-celery.glitch.me/</a>.", "Build a full stack JavaScript app that is functionally similar to this: <a href='https://horn-celery.glitch.me/' target='_blank'>https://horn-celery.glitch.me/</a>.",
"Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicaly visible for our testing.", "Working on this project will involve you writing your code on Glitch on our starter project. After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.",
"Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-messageboard/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-messageboard/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!" "Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-messageboard/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-project-messageboard/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!"
], ],
"challengeSeed": [], "challengeSeed": [],

View File

@ -11,7 +11,7 @@
[ [
"", "",
"", "",
"As your programs become more complex, you need to test them often to make sure any new code you add doesn't break the program's original functionality. Chai is a JavaScript testing library that helps you check that your program still behaves the way you expect it to after you make changes. Using Chai, you can write tests that describe your program's requirements and see if your program meets them.<br><br>Working on these challenges will involve you writing your code on Glitch on our starter project. After completing each challenge you can copy your public glitch url (to the homepage of your app) into the challenge screen to test it! Optionally you may choose to write your project on another platform but it must be publicaly visible for our testing.<br>Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!", "As your programs become more complex, you need to test them often to make sure any new code you add doesn't break the program's original functionality. Chai is a JavaScript testing library that helps you check that your program still behaves the way you expect it to after you make changes. Using Chai, you can write tests that describe your program's requirements and see if your program meets them.<br><br>Working on these challenges will involve you writing your code on Glitch on our starter project. After completing each challenge you can copy your public glitch url (to the homepage of your app) into the challenge screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.<br>Start this project on Glitch using <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>this link</a> or clone <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>this repository</a> on GitHub! If you use Glitch, remember to save the link to your project somewhere safe!",
"" ""
] ]
], ],
@ -771,7 +771,7 @@
"testString": "getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })" "testString": "getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })"
}, },
{ {
"text": "assert that the headless browser request succeded", "text": "assert that the headless browser request succeeded",
"testString": "getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[0].method, 'browser.success'); }, xhr => { throw new Error(xhr.responseText); })" "testString": "getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[0].method, 'browser.success'); }, xhr => { throw new Error(xhr.responseText); })"
}, },
{ {
@ -808,7 +808,7 @@
"testString": "getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })" "testString": "getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })"
}, },
{ {
"text": " assert that the headless browser request succeded", "text": " assert that the headless browser request succeeded",
"testString": "getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[0].method, 'browser.success'); }, xhr => { throw new Error(xhr.responseText); })" "testString": "getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[0].method, 'browser.success'); }, xhr => { throw new Error(xhr.responseText); })"
}, },
{ {

View File

@ -282,7 +282,7 @@
"Here we will see bubble sort. The bubble sort method starts at the beginning of an unsorted array and 'bubbles up' unsorted values towards the end, iterating through the array until it is completely sorted. It does this by comparing adjacent items and swapping them if they are out of order. The method continues looping through the array until no swaps occur at which point the array is sorted.", "Here we will see bubble sort. The bubble sort method starts at the beginning of an unsorted array and 'bubbles up' unsorted values towards the end, iterating through the array until it is completely sorted. It does this by comparing adjacent items and swapping them if they are out of order. The method continues looping through the array until no swaps occur at which point the array is sorted.",
"This method requires multiple iterations through the array and for average and worst cases has quadratic time complexity. While simple, it is usually impractical in most situations.", "This method requires multiple iterations through the array and for average and worst cases has quadratic time complexity. While simple, it is usually impractical in most situations.",
"<strong>Instructions:</strong> Write a function <code>bubbleSort</code> which takes an array of integers as input and returns an array of these integers in sorted order from least to greatest.", "<strong>Instructions:</strong> Write a function <code>bubbleSort</code> which takes an array of integers as input and returns an array of these integers in sorted order from least to greatest.",
"<strong>Note:</strong><br>We are calling this function from behind the scenes; the test array we are using is commented out in the editor. Try logging <code>array</code> to see your sorting alogrithm in action!" "<strong>Note:</strong><br>We are calling this function from behind the scenes; the test array we are using is commented out in the editor. Try logging <code>array</code> to see your sorting algorithm in action!"
], ],
"challengeSeed": [ "challengeSeed": [
"function bubbleSort(array) {", "function bubbleSort(array) {",
@ -318,8 +318,8 @@
"title": "Implement Selection Sort", "title": "Implement Selection Sort",
"description": [ "description": [
"Here we will implement selection sort. Selection sort works by selecting the minimum value in a list and swapping it with the first value in the list. It then starts at the second position, selects the smallest value in the remaining list, and swaps it with the second element. It continues iterating through the list and swapping elements until it reaches the end of the list. Now the list is sorted. Selection sort has quadratic time complexity in all cases.", "Here we will implement selection sort. Selection sort works by selecting the minimum value in a list and swapping it with the first value in the list. It then starts at the second position, selects the smallest value in the remaining list, and swaps it with the second element. It continues iterating through the list and swapping elements until it reaches the end of the list. Now the list is sorted. Selection sort has quadratic time complexity in all cases.",
"<stong>Instructions</stong>: Write a function <code>selectionSort</code> which takes an array of integers as input and returns an array of these integers in sorted order from least to greatest.", "<strong>Instructions</strong>: Write a function <code>selectionSort</code> which takes an array of integers as input and returns an array of these integers in sorted order from least to greatest.",
"<strong>Note:</strong><br>We are calling this function from behind the scenes; the test array we are using is commented out in the editor. Try logging <code>array</code> to see your sorting alogrithm in action!" "<strong>Note:</strong><br>We are calling this function from behind the scenes; the test array we are using is commented out in the editor. Try logging <code>array</code> to see your sorting algorithm in action!"
], ],
"challengeSeed": [ "challengeSeed": [
"function selectionSort(array) {", "function selectionSort(array) {",
@ -356,7 +356,7 @@
"description": [ "description": [
"The next sorting method we'll look at is insertion sort. This method works by building up a sorted array at the beginning of the list. It begins the sorted array with the first element. Then it inspects the next element and swaps it backwards into the sorted array until it is in sorted position. It continues iterating through the list and swapping new items backwards into the sorted portion until it reaches the end. This algorithm has quadratic time complexity in the average and worst cases.", "The next sorting method we'll look at is insertion sort. This method works by building up a sorted array at the beginning of the list. It begins the sorted array with the first element. Then it inspects the next element and swaps it backwards into the sorted array until it is in sorted position. It continues iterating through the list and swapping new items backwards into the sorted portion until it reaches the end. This algorithm has quadratic time complexity in the average and worst cases.",
"<strong>Instructions:</strong> Write a function <code>insertionSort</code> which takes an array of integers as input and returns an array of these integers in sorted order from least to greatest.", "<strong>Instructions:</strong> Write a function <code>insertionSort</code> which takes an array of integers as input and returns an array of these integers in sorted order from least to greatest.",
"<strong>Note:</strong><br>We are calling this function from behind the scenes; the test array we are using is commented out in the editor. Try logging <code>array</code> to see your sorting alogrithm in action!" "<strong>Note:</strong><br>We are calling this function from behind the scenes; the test array we are using is commented out in the editor. Try logging <code>array</code> to see your sorting algorithm in action!"
], ],
"challengeSeed": [ "challengeSeed": [
"function insertionSort(array) {", "function insertionSort(array) {",
@ -394,7 +394,7 @@
"Here we will move on to an intermediate sorting algorithm: quick sort. Quick sort is an efficient, recursive divide-and-conquer approach to sorting an array. In this method, a pivot value is chosen in the original array. The array is then partitioned into two subarrays of values less than and greater than the pivot value. We then combine the result of recursively calling the quick sort algorithm on both sub-arrays. This continues until the base case of an empty or single-item array is reached, which we return. The unwinding of the recursive calls return us the sorted array.", "Here we will move on to an intermediate sorting algorithm: quick sort. Quick sort is an efficient, recursive divide-and-conquer approach to sorting an array. In this method, a pivot value is chosen in the original array. The array is then partitioned into two subarrays of values less than and greater than the pivot value. We then combine the result of recursively calling the quick sort algorithm on both sub-arrays. This continues until the base case of an empty or single-item array is reached, which we return. The unwinding of the recursive calls return us the sorted array.",
"Quick sort is a very efficient sorting method, providing <i>O(nlog(n))</i> performance on average. It is also relatively easy to implement. These attributes make it a popular and useful sorting method.", "Quick sort is a very efficient sorting method, providing <i>O(nlog(n))</i> performance on average. It is also relatively easy to implement. These attributes make it a popular and useful sorting method.",
"<strong>Instructions:</strong> Write a function <code>quickSort</code> which takes an array of integers as input and returns an array of these integers in sorted order from least to greatest. While the choice of the pivot value is important, any pivot will do for our purposes here. For simplicity, the first or last element could be used.", "<strong>Instructions:</strong> Write a function <code>quickSort</code> which takes an array of integers as input and returns an array of these integers in sorted order from least to greatest. While the choice of the pivot value is important, any pivot will do for our purposes here. For simplicity, the first or last element could be used.",
"<strong>Note:</strong><br>We are calling this function from behind the scenes; the test array we are using is commented out in the editor. Try logging <code>array</code> to see your sorting alogrithm in action!" "<strong>Note:</strong><br>We are calling this function from behind the scenes; the test array we are using is commented out in the editor. Try logging <code>array</code> to see your sorting algorithm in action!"
], ],
"challengeSeed": [ "challengeSeed": [
"function quickSort(array) {", "function quickSort(array) {",
@ -435,7 +435,7 @@
"Merge sort is an efficient sorting method, with time complexity of <i>O(nlog(n))</i>. This algorithm is popular because it is performant and relatively easy to implement.", "Merge sort is an efficient sorting method, with time complexity of <i>O(nlog(n))</i>. This algorithm is popular because it is performant and relatively easy to implement.",
"As an aside, this will be the last sorting algorithm we cover here. However, later in the section on tree data structures we will describe heap sort, another efficient sorting method that requires a binary heap in its implementation.", "As an aside, this will be the last sorting algorithm we cover here. However, later in the section on tree data structures we will describe heap sort, another efficient sorting method that requires a binary heap in its implementation.",
"<strong>Instructions:</strong> Write a function <code>mergeSort</code> which takes an array of integers as input and returns an array of these integers in sorted order from least to greatest. A good way to implement this is to write one function, for instance <code>merge</code>, which is responsible for merging two sorted arrays, and another function, for instance <code>mergeSort</code>, which is responsible for the recursion that produces single-item arrays to feed into merge. Good luck!", "<strong>Instructions:</strong> Write a function <code>mergeSort</code> which takes an array of integers as input and returns an array of these integers in sorted order from least to greatest. A good way to implement this is to write one function, for instance <code>merge</code>, which is responsible for merging two sorted arrays, and another function, for instance <code>mergeSort</code>, which is responsible for the recursion that produces single-item arrays to feed into merge. Good luck!",
"<strong>Note:</strong><br>We are calling this function from behind the scenes; the test array we are using is commented out in the editor. Try logging <code>array</code> to see your sorting alogrithm in action!" "<strong>Note:</strong><br>We are calling this function from behind the scenes; the test array we are using is commented out in the editor. Try logging <code>array</code> to see your sorting algorithm in action!"
], ],
"challengeSeed": [ "challengeSeed": [
"function mergeSort(array) {", "function mergeSort(array) {",

View File

@ -838,7 +838,7 @@
"id": "8d5823c8c441eddfaeb5bdef", "id": "8d5823c8c441eddfaeb5bdef",
"title": "Create a Map Data Structure", "title": "Create a Map Data Structure",
"description": [ "description": [
"The next few challenges will cover maps and hash tables. Maps are data structurs that store key-value pairs. In JavaScript, these are available to us as objects. Maps provide rapid lookup of stored items based on key values and are very common and useful data structures.", "The next few challenges will cover maps and hash tables. Maps are data structures that store key-value pairs. In JavaScript, these are available to us as objects. Maps provide rapid lookup of stored items based on key values and are very common and useful data structures.",
"Instructions: Let's get some practice creating our own map. Because JavaScript objects provide a much more efficient map structure than anything we could write here, this is intended primarily as a learning exercise. However, JavaScript objects only provide us with certain operations. What if we wanted to define custom operations?", "Instructions: Let's get some practice creating our own map. Because JavaScript objects provide a much more efficient map structure than anything we could write here, this is intended primarily as a learning exercise. However, JavaScript objects only provide us with certain operations. What if we wanted to define custom operations?",
"Use the <code>Map</code> object provided here as a wrapper around a JavaScript <code>object</code>. Create the following methods and operations on the Map object:", "Use the <code>Map</code> object provided here as a wrapper around a JavaScript <code>object</code>. Create the following methods and operations on the Map object:",
"<code>add</code> accepts a <code>key, value</code> pair to add to the map", "<code>add</code> accepts a <code>key, value</code> pair to add to the map",

View File

@ -19930,7 +19930,7 @@
"", "",
"", "",
"", "",
"Many millenia ago Leonhard reported to Katharina to have found the answer and he is willing to share it with any life form who proves to be worthy of such knowledge.", "Many millennia ago Leonhard reported to Katharina to have found the answer and he is willing to share it with any life form who proves to be worthy of such knowledge.",
"", "",
"Katharina further explains that the designers of Leonhard were given instructions to program him with equal probability of remaining in the same room or travelling to an adjacent room. However, it was not clear to them if this meant (i) an equal probability being split equally between remaining in the room and the number of available routes, or, (ii) an equal probability (50%) of remaining in the same room and then the other 50% was to be split equally between the number of available routes.", "Katharina further explains that the designers of Leonhard were given instructions to program him with equal probability of remaining in the same room or travelling to an adjacent room. However, it was not clear to them if this meant (i) an equal probability being split equally between remaining in the room and the number of available routes, or, (ii) an equal probability (50%) of remaining in the same room and then the other 50% was to be split equally between the number of available routes.",
"", "",

View File

@ -1451,7 +1451,7 @@
"]</pre></p>", "]</pre></p>",
"Task:", "Task:",
"<p>Write a function to take a deal number and deal cards in the same order as this algorithm.</p>", "<p>Write a function to take a deal number and deal cards in the same order as this algorithm.</p>",
"<p>The function must return a two dimentional array representing the FreeCell board.</p>", "<p>The function must return a two dimensional array representing the FreeCell board.</p>",
"<p>Deals can also be checked against <a href=\"http://freecellgamesolutions.com/\" title=\"link: http://freecellgamesolutions.com/\">FreeCell solutions to 1000000 games</a>.</p>", "<p>Deals can also be checked against <a href=\"http://freecellgamesolutions.com/\" title=\"link: http://freecellgamesolutions.com/\">FreeCell solutions to 1000000 games</a>.</p>",
"<p>(Summon a video solution, and it displays the initial deal.)</p>" "<p>(Summon a video solution, and it displays the initial deal.)</p>"
], ],
@ -1718,7 +1718,7 @@
"type": "Waypoint", "type": "Waypoint",
"description": [ "description": [
"<p>An emirp (prime spelled backwards) are primes that when reversed (in their decimal representation) are a different prime.</p>", "<p>An emirp (prime spelled backwards) are primes that when reversed (in their decimal representation) are a different prime.</p>",
"<p>Write a function that should be able to : Show the first <b>n</b> eprimes numbers.Show the eprimes numbers in a range.Show the number of eprimes in a range.Show the <b>n<sup>th</sup></b> eprimes number.<p>The function should have two paramters. The first will recieve <b>n</b> or the range as an array. The second will recieve a boolean, that specifies if the function returns the eprimes as an array or a single number(the number of primes in the range or the <b>n<sup>th</sup></b> prime). According to the parameters the function should return an array or a number." "<p>Write a function that should be able to : Show the first <b>n</b> eprimes numbers.Show the eprimes numbers in a range.Show the number of eprimes in a range.Show the <b>n<sup>th</sup></b> eprimes number.<p>The function should have two parameters. The first will receive <b>n</b> or the range as an array. The second will receive a boolean, that specifies if the function returns the eprimes as an array or a single number(the number of primes in the range or the <b>n<sup>th</sup></b> prime). According to the parameters the function should return an array or a number."
], ],
"null": [], "null": [],
"challengeSeed": [ "challengeSeed": [
@ -2133,7 +2133,7 @@
"title": "Extensible prime generator", "title": "Extensible prime generator",
"type": "Waypoint", "type": "Waypoint",
"description": [ "description": [
"<p>Write a generator of prime numbers, in order, that will automatically adjust to accommodate the generation of any reasonably high prime.</p> The generator should be able to : Show the first <b>n</b> prime numbers.Show the prime numbers in a range.Show the number of primes in a range.Show the <b>n<sup>th</sup></b> prime number.<p>The function should have two paramters. The first will recieve <b>n</b> or the range as an array. The second will recieve a boolean, that specifies if the function returns the prime numbers as an array or a single number(the number of primes in the range or the <b>n<sup>th</sup></b> prime). According to the parameters the function should return an array." "<p>Write a generator of prime numbers, in order, that will automatically adjust to accommodate the generation of any reasonably high prime.</p> The generator should be able to : Show the first <b>n</b> prime numbers.Show the prime numbers in a range.Show the number of primes in a range.Show the <b>n<sup>th</sup></b> prime number.<p>The function should have two parameters. The first will receive <b>n</b> or the range as an array. The second will receive a boolean, that specifies if the function returns the prime numbers as an array or a single number(the number of primes in the range or the <b>n<sup>th</sup></b> prime). According to the parameters the function should return an array."
], ],
"challengeSeed": [ "challengeSeed": [
"function primeGenerator (num, showPrimes) {", "function primeGenerator (num, showPrimes) {",
@ -2316,7 +2316,7 @@
"title": "Fibonacci n-step number sequences", "title": "Fibonacci n-step number sequences",
"type": "Waypoint", "type": "Waypoint",
"description": [ "description": [
"<p>Write a function to generate Fibonacci n-step number sequences and Lucas sequences. The first parameter will be n. The second parameter will be the number of elements to be returned. The third paramter will specify whether to output the Fibonacci sequence or the Lucas sequence. If the parameter is \"f\" then return the Fibonacci sequence and if it is \"l\", then return the Lucas sequence. The sequences must be returned as an array. More details are given below : </p><p>These number series are an expansion of the ordinary <a href=\"http://rosettacode.org/wiki/Fibonacci sequence\" title=\"Fibonacci sequence\">Fibonacci sequence</a> where:</p>", "<p>Write a function to generate Fibonacci n-step number sequences and Lucas sequences. The first parameter will be n. The second parameter will be the number of elements to be returned. The third parameter will specify whether to output the Fibonacci sequence or the Lucas sequence. If the parameter is \"f\" then return the Fibonacci sequence and if it is \"l\", then return the Lucas sequence. The sequences must be returned as an array. More details are given below : </p><p>These number series are an expansion of the ordinary <a href=\"http://rosettacode.org/wiki/Fibonacci sequence\" title=\"Fibonacci sequence\">Fibonacci sequence</a> where:</p>",
"For $n = 2$ we have the Fibonacci sequence; with initial values $[1, 1]$ and $F_k^2 = F_{k-1}^2 + F_{k-2}^2$", "For $n = 2$ we have the Fibonacci sequence; with initial values $[1, 1]$ and $F_k^2 = F_{k-1}^2 + F_{k-2}^2$",
"For $n = 3$ we have the tribonacci sequence; with initial values $[1, 1, 2]$ and $F_k^3 = F_{k-1}^3 + F_{k-2}^3 + F_{k-3}^3$", "For $n = 3$ we have the tribonacci sequence; with initial values $[1, 1, 2]$ and $F_k^3 = F_{k-1}^3 + F_{k-2}^3 + F_{k-3}^3$",
"For $n = 4$ we have the tetranacci sequence; with initial values $[1, 1, 2, 4]$ and $F_k^4 = F_{k-1}^4 + F_{k-2}^4 + F_{k-3}^4 + F_{k-4}^4$...", "For $n = 4$ we have the tetranacci sequence; with initial values $[1, 1, 2, 4]$ and $F_k^4 = F_{k-1}^4 + F_{k-2}^4 + F_{k-3}^4 + F_{k-4}^4$...",
@ -5931,7 +5931,7 @@
"<p>{| style=\"white-space: nowrap;\"</p>", "<p>{| style=\"white-space: nowrap;\"</p>",
"<p>|-</p>", "<p>|-</p>",
"<p>! Input<small style=\"font-weight:normal\">(single string)</small></p>", "<p>! Input<small style=\"font-weight:normal\">(single string)</small></p>",
"<p>! Ouput<small style=\"font-weight:normal\">(list/array of strings)</small></p>", "<p>! Output<small style=\"font-weight:normal\">(list/array of strings)</small></p>",
"<p>|- style=\"vertical-align:top\"</p>", "<p>|- style=\"vertical-align:top\"</p>",
"<p>|</p>", "<p>|</p>",
"<p><code>~/{Downloads,Pictures}/*.{jpg,gif,png}</code></p>", "<p><code>~/{Downloads,Pictures}/*.{jpg,gif,png}</code></p>",
@ -10990,7 +10990,7 @@
"title": "First class environments", "title": "First class environments",
"type": "Waypoint", "type": "Waypoint",
"description": [ "description": [
"<p>According to <a href=\"https://en.wikipedia.org/wiki/First-class_object\" title=\"wp: First-class_object\">Wikipedia</a>, \"In computing, a first-class object ... is an entity that can be constructed at run-time, passed as a parameter, returned from a subroutine, or assigned into a variable\".</p><p>Often this term is used in the context of \"first class functions\". In an analogous way, a programming language may support \"first class environments\".</p><p>The environment is minimally, the set of variables accessable to a statement being executed. Change the environments and the same statement could produce different results when executed.</p><p>Often an environment is captured in a <a href=\"https://en.wikipedia.org/wiki/Closure_(computer_science)\" title=\"wp: Closure_(computer_science)\">closure</a>, which encapsulates a function together with an environment. That environment, however, is not first-class, as it cannot be created, passed etc. independently from the function's code.</p><p>Therefore, a first class environment is a set of variable bindings which can be constructed at run-time, passed as a parameter, returned from a subroutine, or assigned into a variable. It is like a closure without code. A statement must be able to be executed within a stored first class environment and act according to the environment variable values stored within.</p><p>The task: Build a dozen environments, and a single piece of code to be run repeatedly in each of these envionments.</p><p>Each environment contains the bindings for two variables: A value in the <a href=\"http://rosettacode.org/wiki/Hailstone sequence\" title=\"Hailstone sequence\">Hailstone sequence</a>, and a count which is incremented until the value drops to 1. The initial hailstone values are 1 through 12, and the count in each environment is zero.</p><p>When the code runs, it calculates the next hailstone step in the current environment (unless the value is already 1) and counts the steps. Then it prints the current value in a tabular form.</p><p>When all hailstone values dropped to 1, processing stops, and the total number of hailstone steps for each environment is printed.</p>" "<p>According to <a href=\"https://en.wikipedia.org/wiki/First-class_object\" title=\"wp: First-class_object\">Wikipedia</a>, \"In computing, a first-class object ... is an entity that can be constructed at run-time, passed as a parameter, returned from a subroutine, or assigned into a variable\".</p><p>Often this term is used in the context of \"first class functions\". In an analogous way, a programming language may support \"first class environments\".</p><p>The environment is minimally, the set of variables accessible to a statement being executed. Change the environments and the same statement could produce different results when executed.</p><p>Often an environment is captured in a <a href=\"https://en.wikipedia.org/wiki/Closure_(computer_science)\" title=\"wp: Closure_(computer_science)\">closure</a>, which encapsulates a function together with an environment. That environment, however, is not first-class, as it cannot be created, passed etc. independently from the function's code.</p><p>Therefore, a first class environment is a set of variable bindings which can be constructed at run-time, passed as a parameter, returned from a subroutine, or assigned into a variable. It is like a closure without code. A statement must be able to be executed within a stored first class environment and act according to the environment variable values stored within.</p><p>The task: Build a dozen environments, and a single piece of code to be run repeatedly in each of these envionments.</p><p>Each environment contains the bindings for two variables: A value in the <a href=\"http://rosettacode.org/wiki/Hailstone sequence\" title=\"Hailstone sequence\">Hailstone sequence</a>, and a count which is incremented until the value drops to 1. The initial hailstone values are 1 through 12, and the count in each environment is zero.</p><p>When the code runs, it calculates the next hailstone step in the current environment (unless the value is already 1) and counts the steps. Then it prints the current value in a tabular form.</p><p>When all hailstone values dropped to 1, processing stops, and the total number of hailstone steps for each environment is printed.</p>"
], ],
"challengeSeed": [ "challengeSeed": [
"function replaceMe (foo) {", "function replaceMe (foo) {",
@ -18126,7 +18126,7 @@
"<p>\\end{pmatrix}</p>", "<p>\\end{pmatrix}</p>",
"<p>$</p><p>The decomposition algorithm is then applied on the rearranged matrix so that</p><p>$PA = LU$</p>", "<p>$</p><p>The decomposition algorithm is then applied on the rearranged matrix so that</p><p>$PA = LU$</p>",
"<p>Task description</p><p>The task is to implement a routine which will take a square nxn matrix $A$ and return a lower triangular matrix $L$, a upper triangular matrix $U$ and a permutation matrix $P$,</p>", "<p>Task description</p><p>The task is to implement a routine which will take a square nxn matrix $A$ and return a lower triangular matrix $L$, a upper triangular matrix $U$ and a permutation matrix $P$,</p>",
"<p>so that the above equation is fullfilled.</p>", "<p>so that the above equation is fulfilled.</p>",
"<p>You should then test it on the following two examples and include your output.</p><p>Example 1:</p>", "<p>You should then test it on the following two examples and include your output.</p><p>Example 1:</p>",
"<pre>", "<pre>",
"A1 3 5", "A1 3 5",
@ -18461,7 +18461,7 @@
"<p>So we see that the sequence starting with 689 converges to, and continues with the same numbers as that for 196. Because of this we can further split the Lychrel numbers into true Seed Lychrel number candidates, and Related numbers that produce no palindromes but have integers in their sequence seen as part of the sequence generated from a lower Lychrel number.</p>", "<p>So we see that the sequence starting with 689 converges to, and continues with the same numbers as that for 196. Because of this we can further split the Lychrel numbers into true Seed Lychrel number candidates, and Related numbers that produce no palindromes but have integers in their sequence seen as part of the sequence generated from a lower Lychrel number.</p>",
"Task:", "Task:",
" Find the number of seed Lychrel number candidates and related numbers for n in the range 1..10000 inclusive. (With that iteration limit of 500).", " Find the number of seed Lychrel number candidates and related numbers for n in the range 1..10000 inclusive. (With that iteration limit of 500).",
" Print the number of seed Lychrels found; the actual seed Lychrels; and just the number of relateds found.", " Print the number of seed Lychrels found; the actual seed Lychrels; and just the number of relates found.",
" Print any seed Lychrel or related number that is itself a palindrome.", " Print any seed Lychrel or related number that is itself a palindrome.",
"<p>Show all output here.</p>", "<p>Show all output here.</p>",
"References:", "References:",
@ -22547,7 +22547,7 @@
"", "",
"// first read self ", "// first read self ",
"var self = readfile(WScript.ScriptFullName);", "var self = readfile(WScript.ScriptFullName);",
"// read whatever file is given on commmand line", "// read whatever file is given on command line",
"var whatever = readfile(WScript.Arguments.UnNamed(0));", "var whatever = readfile(WScript.Arguments.UnNamed(0));",
"", "",
"// compare and contrast", "// compare and contrast",
@ -22603,8 +22603,8 @@
"['ignore leading spaces: 2-2', ' ignore leading spaces: 2-1', ' ignore leading spaces: 2+0', ' ignore leading spaces: 2+1']Ignoring multiple adjacent spaces (m.a.s)Text strings:", "['ignore leading spaces: 2-2', ' ignore leading spaces: 2-1', ' ignore leading spaces: 2+0', ' ignore leading spaces: 2+1']Ignoring multiple adjacent spaces (m.a.s)Text strings:",
"['ignore m.a.s spaces: 2-2', 'ignore m.a.s spaces: 2-1', 'ignore m.a.s spaces: 2+0', 'ignore m.a.s spaces: 2+1']", "['ignore m.a.s spaces: 2-2', 'ignore m.a.s spaces: 2-1', 'ignore m.a.s spaces: 2+0', 'ignore m.a.s spaces: 2+1']",
"Equivalent whitespace charactersText strings:", "Equivalent whitespace charactersText strings:",
"['Equiv. spaces: 3-3', 'Equiv.\\rspaces: 3-2', 'Equiv.\\x0cspaces: 3-1', 'Equiv.\\x0bspaces: 3+0', 'Equiv.\\nspaces: 3+1', 'Equiv.\\tspaces: 3+2']Case Indepenent sortText strings:", "['Equiv. spaces: 3-3', 'Equiv.\\rspaces: 3-2', 'Equiv.\\x0cspaces: 3-1', 'Equiv.\\x0bspaces: 3+0', 'Equiv.\\nspaces: 3+1', 'Equiv.\\tspaces: 3+2']Case Independent sortText strings:",
"['cASE INDEPENENT: 3-2', 'caSE INDEPENENT: 3-1', 'casE INDEPENENT: 3+0', 'case INDEPENENT: 3+1']Numeric fields as numericsText strings:", "['cASE INDEPENDENT: 3-2', 'caSE INDEPENDENT: 3-1', 'casE INDEPENDENT: 3+0', 'case INDEPENDENT: 3+1']Numeric fields as numericsText strings:",
"['foo100bar99baz0.txt', 'foo100bar10baz0.txt', 'foo1000bar99baz10.txt', 'foo1000bar99baz9.txt']Title sortsText strings:", "['foo100bar99baz0.txt', 'foo100bar10baz0.txt', 'foo1000bar99baz10.txt', 'foo1000bar99baz9.txt']Title sortsText strings:",
"['The Wind in the Willows', 'The 40th step more', 'The 39 steps', 'Wanda']Equivalent accented characters (and case)Text strings:", "['The Wind in the Willows', 'The 40th step more', 'The 39 steps', 'Wanda']Equivalent accented characters (and case)Text strings:",
"[u'Equiv. \\xfd accents: 2-2', u'Equiv. \\xdd accents: 2-1', u'Equiv. y accents: 2+0', u'Equiv. Y accents: 2+1']", "[u'Equiv. \\xfd accents: 2-2', u'Equiv. \\xdd accents: 2-1', u'Equiv. y accents: 2+0', u'Equiv. Y accents: 2+1']",
@ -23494,7 +23494,7 @@
"<p>|In the case of Gauss-Legendre quadrature, the weighting function $W(x) = 1$, so we can approximate an integral of $f(x)$ with:</p>", "<p>|In the case of Gauss-Legendre quadrature, the weighting function $W(x) = 1$, so we can approximate an integral of $f(x)$ with:</p>",
"<p>|$\\int_{-1}^1 f(x)\\,dx \\approx \\sum_{i=1}^n w_i f(x_i)$</p>", "<p>|$\\int_{-1}^1 f(x)\\,dx \\approx \\sum_{i=1}^n w_i f(x_i)$</p>",
"<p>|}</p>", "<p>|}</p>",
"<p>For this, we first need to calculate the nodes and the weights, but after we have them, we can reuse them for numerious integral evaluations, which greatly speeds up the calculation compared to more <a href=\"http://rosettacode.org/wiki/Numerical Integration\" title=\"Numerical Integration\">simple numerical integration methods</a>.</p><p>{|border=1 cellspacing=0 cellpadding=3</p>", "<p>For this, we first need to calculate the nodes and the weights, but after we have them, we can reuse them for numerous integral evaluations, which greatly speeds up the calculation compared to more <a href=\"http://rosettacode.org/wiki/Numerical Integration\" title=\"Numerical Integration\">simple numerical integration methods</a>.</p><p>{|border=1 cellspacing=0 cellpadding=3</p>",
"<p>|The $n$ evaluation points $x_i$ for a n-point rule, also called \"nodes\", are roots of n-th order <a href=\"https://en.wikipedia.org/wiki/Legendre Polynomials\" title=\"wp: Legendre Polynomials\">Legendre Polynomials</a> $P_n(x)$. Legendre polynomials are defined by the following recursive rule:</p>", "<p>|The $n$ evaluation points $x_i$ for a n-point rule, also called \"nodes\", are roots of n-th order <a href=\"https://en.wikipedia.org/wiki/Legendre Polynomials\" title=\"wp: Legendre Polynomials\">Legendre Polynomials</a> $P_n(x)$. Legendre polynomials are defined by the following recursive rule:</p>",
"<p>|$P_0(x) = 1$</p>", "<p>|$P_0(x) = 1$</p>",
"<p>$P_1(x) = x$</p>", "<p>$P_1(x) = x$</p>",
@ -26516,7 +26516,7 @@
" (3, 1, 0, 2) -> 20", " (3, 1, 0, 2) -> 20",
" (3, 1, 2, 0) -> 21", " (3, 1, 2, 0) -> 21",
" (3, 2, 0, 1) -> 22", " (3, 2, 0, 1) -> 22",
" (3, 2, 1, 0) -> 23</pre><p>Algorithms exist that can generate a rank from a permutation for some particular ordering of permutations, and that can generate the same rank from the given individual permutation (i.e. given a rank of 17 produce (2, 3, 1, 0) in the example above).</p><p>One use of such algorithms could be in generating a small, random, sample of permutations of $n$ items without duplicates when the total number of permutations is large. Remember that the total number of permutations of $n$ items is given by $n!$ which grows large very quickly: A 32 bit integer can only hold $12!$, a 64 bit integer only $20!$. It becomes difficult to take the straight-forward approach of generating all permutations then taking a random sample of them.</p><p>A <a href=\"http://stackoverflow.com/questions/12884428/generate-sample-of-1-000-000-random-permutations\" title=\"link: http://stackoverflow.com/questions/12884428/generate-sample-of-1-000-000-random-permutations\">question on the Stack Overflow site</a> asked how to generate one million random and indivudual permutations of 144 items.</p>", " (3, 2, 1, 0) -> 23</pre><p>Algorithms exist that can generate a rank from a permutation for some particular ordering of permutations, and that can generate the same rank from the given individual permutation (i.e. given a rank of 17 produce (2, 3, 1, 0) in the example above).</p><p>One use of such algorithms could be in generating a small, random, sample of permutations of $n$ items without duplicates when the total number of permutations is large. Remember that the total number of permutations of $n$ items is given by $n!$ which grows large very quickly: A 32 bit integer can only hold $12!$, a 64 bit integer only $20!$. It becomes difficult to take the straight-forward approach of generating all permutations then taking a random sample of them.</p><p>A <a href=\"http://stackoverflow.com/questions/12884428/generate-sample-of-1-000-000-random-permutations\" title=\"link: http://stackoverflow.com/questions/12884428/generate-sample-of-1-000-000-random-permutations\">question on the Stack Overflow site</a> asked how to generate one million random and individual permutations of 144 items.</p>",
"Task:", "Task:",
"Create a function to generate a permutation from a rank.", "Create a function to generate a permutation from a rank.",
"Create the inverse function that given the permutation generates its rank.", "Create the inverse function that given the permutation generates its rank.",
@ -41442,7 +41442,7 @@
"function printtruthtable(){", "function printtruthtable(){",
"\tvar i,str;", "\tvar i,str;",
"\telem=document.createElement(\"pre\");", "\telem=document.createElement(\"pre\");",
"\texpr=prompt(\"Boolean expression:\\nAccepts single-character variables (except for \\\"T\\\" and \\\"F\\\", which specify explicit true or false values), postfix, with \\\"&|!^\\\" for and, or, not, xor, respectively; optionally seperated by whitespace.\").replace(/\\s/g,\"\");", "\texpr=prompt(\"Boolean expression:\\nAccepts single-character variables (except for \\\"T\\\" and \\\"F\\\", which specify explicit true or false values), postfix, with \\\"&|!^\\\" for and, or, not, xor, respectively; optionally separated by whitespace.\").replace(/\\s/g,\"\");",
"\tvars=[];", "\tvars=[];",
"\tfor(i=0;i<expr.length;i++)if(!isboolop(expr[i])&&expr[i]!=\"T\"&&expr[i]!=\"F\"&&varsindexof(expr[i])==-1)vars.push([expr[i],-1]);", "\tfor(i=0;i<expr.length;i++)if(!isboolop(expr[i])&&expr[i]!=\"T\"&&expr[i]!=\"F\"&&varsindexof(expr[i])==-1)vars.push([expr[i],-1]);",
"\tif(vars.length==0)return;", "\tif(vars.length==0)return;",
@ -41518,7 +41518,7 @@
"releasedOn": "December 27, 2017", "releasedOn": "December 27, 2017",
"isBeta": "true", "isBeta": "true",
"betaSolutions": [ "betaSolutions": [
"<!DOCTYPE html><html><head><title>Truth table</title><script>\nvar elem,expr,vars;\nfunction isboolop(chr){return \"&|!^\".indexOf(chr)!=-1;}\nfunction varsindexof(chr){\n\tvar i;\n\tfor(i=0;i<vars.length;i++){if(vars[i][0]==chr)return i;}\n\treturn -1;\n}\nfunction printtruthtable(){\n\tvar i,str;\n\telem=document.createElement(\"pre\");\n\texpr=prompt(\"Boolean expression:\\nAccepts single-character variables (except for \\\"T\\\" and \\\"F\\\", which specify explicit true or false values), postfix, with \\\"&|!^\\\" for and, or, not, xor, respectively; optionally seperated by whitespace.\").replace(/\\s/g,\"\");\n\tvars=[];\n\tfor(i=0;i<expr.length;i++)if(!isboolop(expr[i])&&expr[i]!=\"T\"&&expr[i]!=\"F\"&&varsindexof(expr[i])==-1)vars.push([expr[i],-1]);\n\tif(vars.length==0)return;\n\tstr=\"\";\n\tfor(i=0;i<vars.length;i++)str+=vars[i][0]+\" \";\n\telem.innerHTML=\"<b>\"+str+expr+\"</b>\\n\";\n\tvars[0][1]=false;\n\ttruthpartfor(1);\n\tvars[0][1]=true;\n\ttruthpartfor(1);\n\tvars[0][1]=-1;\n\tdocument.body.appendChild(elem);\n}\nfunction truthpartfor(index){\n\tif(index==vars.length){\n\t\tvar str,i;\n\t\tstr=\"\";\n\t\tfor(i=0;i<index;i++)str+=(vars[i][1]?\"<b>T</b>\":\"F\")+\" \";\n\t\telem.innerHTML+=str+(parsebool()?\"<b>T</b>\":\"F\")+\"\\n\";\n\t\treturn;\n\t}\n\tvars[index][1]=false;\n\ttruthpartfor(index+1);\n\tvars[index][1]=true;\n\ttruthpartfor(index+1);\n\tvars[index][1]=-1;\n}\nfunction parsebool(){\n\tvar stack,i,idx;\n\tconsole.log(vars);\n\tstack=[];\n\tfor(i=0;i<expr.length;i++){\n\t\tif(expr[i]==\"T\")stack.push(true);\n\t\telse if(expr[i]==\"F\")stack.push(false);\n\t\telse if((idx=varsindexof(expr[i]))!=-1)stack.push(vars[idx][1]);\n\t\telse if(isboolop(expr[i])){\n\t\t\tswitch(expr[i]){\n\t\t\t\tcase \"&\":stack.push(stack.pop()&stack.pop());break;\n\t\t\t\tcase \"|\":stack.push(stack.pop()|stack.pop());break;\n\t\t\t\tcase \"!\":stack.push(!stack.pop());break;\n\t\t\t\tcase \"^\":stack.push(stack.pop()^stack.pop());break;\n\t\t\t}\n\t\t} else alert(\"Non-conformant character \"+expr[i]+\" in expression. Should not be possible.\");\n\t\tconsole.log(stack);\n\t}\n\treturn stack[0];\n}\n</script></head><body onload=\"printtruthtable()\"></body></html>\n" "<!DOCTYPE html><html><head><title>Truth table</title><script>\nvar elem,expr,vars;\nfunction isboolop(chr){return \"&|!^\".indexOf(chr)!=-1;}\nfunction varsindexof(chr){\n\tvar i;\n\tfor(i=0;i<vars.length;i++){if(vars[i][0]==chr)return i;}\n\treturn -1;\n}\nfunction printtruthtable(){\n\tvar i,str;\n\telem=document.createElement(\"pre\");\n\texpr=prompt(\"Boolean expression:\\nAccepts single-character variables (except for \\\"T\\\" and \\\"F\\\", which specify explicit true or false values), postfix, with \\\"&|!^\\\" for and, or, not, xor, respectively; optionally separated by whitespace.\").replace(/\\s/g,\"\");\n\tvars=[];\n\tfor(i=0;i<expr.length;i++)if(!isboolop(expr[i])&&expr[i]!=\"T\"&&expr[i]!=\"F\"&&varsindexof(expr[i])==-1)vars.push([expr[i],-1]);\n\tif(vars.length==0)return;\n\tstr=\"\";\n\tfor(i=0;i<vars.length;i++)str+=vars[i][0]+\" \";\n\telem.innerHTML=\"<b>\"+str+expr+\"</b>\\n\";\n\tvars[0][1]=false;\n\ttruthpartfor(1);\n\tvars[0][1]=true;\n\ttruthpartfor(1);\n\tvars[0][1]=-1;\n\tdocument.body.appendChild(elem);\n}\nfunction truthpartfor(index){\n\tif(index==vars.length){\n\t\tvar str,i;\n\t\tstr=\"\";\n\t\tfor(i=0;i<index;i++)str+=(vars[i][1]?\"<b>T</b>\":\"F\")+\" \";\n\t\telem.innerHTML+=str+(parsebool()?\"<b>T</b>\":\"F\")+\"\\n\";\n\t\treturn;\n\t}\n\tvars[index][1]=false;\n\ttruthpartfor(index+1);\n\tvars[index][1]=true;\n\ttruthpartfor(index+1);\n\tvars[index][1]=-1;\n}\nfunction parsebool(){\n\tvar stack,i,idx;\n\tconsole.log(vars);\n\tstack=[];\n\tfor(i=0;i<expr.length;i++){\n\t\tif(expr[i]==\"T\")stack.push(true);\n\t\telse if(expr[i]==\"F\")stack.push(false);\n\t\telse if((idx=varsindexof(expr[i]))!=-1)stack.push(vars[idx][1]);\n\t\telse if(isboolop(expr[i])){\n\t\t\tswitch(expr[i]){\n\t\t\t\tcase \"&\":stack.push(stack.pop()&stack.pop());break;\n\t\t\t\tcase \"|\":stack.push(stack.pop()|stack.pop());break;\n\t\t\t\tcase \"!\":stack.push(!stack.pop());break;\n\t\t\t\tcase \"^\":stack.push(stack.pop()^stack.pop());break;\n\t\t\t}\n\t\t} else alert(\"Non-conformant character \"+expr[i]+\" in expression. Should not be possible.\");\n\t\tconsole.log(stack);\n\t}\n\treturn stack[0];\n}\n</script></head><body onload=\"printtruthtable()\"></body></html>\n"
], ],
"betaTests": [ "betaTests": [
"assert(typeof replaceMe === 'function', 'message: <code>replaceMe</code> is a function.');" "assert(typeof replaceMe === 'function', 'message: <code>replaceMe</code> is a function.');"

View File

@ -135,7 +135,7 @@
"explanation": "Branch sort is not a sorting algorithm" "explanation": "Branch sort is not a sorting algorithm"
}, },
{ {
"subtitle": "Persistant storage", "subtitle": "Persistent storage",
"question": "CRUD operation stand for ?", "question": "CRUD operation stand for ?",
"choices": [ "choices": [
"<pre><code class='language-javascript'>Create, Read, Update, Delete</code></pre>", "<pre><code class='language-javascript'>Create, Read, Update, Delete</code></pre>",
@ -144,7 +144,7 @@
"<pre><code class='language-javascript'>Cancel, Reduce, Unify, Dispose</code></pre>" "<pre><code class='language-javascript'>Cancel, Reduce, Unify, Dispose</code></pre>"
], ],
"answer": 0, "answer": 0,
"explanation": "CRUD stands for Create - Read - Update and Delete and are the four basic operations of persistant storage" "explanation": "CRUD stands for Create - Read - Update and Delete and are the four basic operations of persistent storage"
}, },
{ {
"subtitle": "Numeric types", "subtitle": "Numeric types",
@ -163,12 +163,12 @@
"question": "The MVC software architectural pattern stands for ?", "question": "The MVC software architectural pattern stands for ?",
"choices": [ "choices": [
"<pre><code class='language-javascript'>MeanStack - View - Class</code></pre>", "<pre><code class='language-javascript'>MeanStack - View - Class</code></pre>",
"<pre><code class='language-javascript'>Modal - Vector - Controll</code></pre>", "<pre><code class='language-javascript'>Modal - Vector - Control</code></pre>",
"<pre><code class='language-javascript'>Model - View - Controller</code></pre>", "<pre><code class='language-javascript'>Model - View - Controller</code></pre>",
"<pre><code class='language-javascript'>Mapped - Volume - Content</code></pre>" "<pre><code class='language-javascript'>Mapped - Volume - Content</code></pre>"
], ],
"answer": 2, "answer": 2,
"explanation": "The MVC pattern is used to keep separate three main componants of an application, the idea being for example the data or 'Model' does not need to know what the 'View' or presentation of that data is doing and vice versa, with the 'Controller' handling any logic or input from the user to manipulate the 'Model'." "explanation": "The MVC pattern is used to keep separate three main components of an application, the idea being for example the data or 'Model' does not need to know what the 'View' or presentation of that data is doing and vice versa, with the 'Controller' handling any logic or input from the user to manipulate the 'Model'."
}, },
{ {
"subtitle": "XPath navigation", "subtitle": "XPath navigation",
@ -691,7 +691,7 @@
"question": "Which best describes the function of the Javascript event loop?", "question": "Which best describes the function of the Javascript event loop?",
"choices": [ "choices": [
"<pre><code class='language-javascript'>To Handle synchronous code one line at a time in the main script.</code></pre>", "<pre><code class='language-javascript'>To Handle synchronous code one line at a time in the main script.</code></pre>",
"<pre><code class='language-javascript'>To remove any blocking functions accidently pushed on to the call stack.</code></pre>", "<pre><code class='language-javascript'>To remove any blocking functions accidentally pushed on to the call stack.</code></pre>",
"<pre><code class='language-javascript'>To constantly monitor if the call stack is empty and then invoke any asynchronous functions from the event queue.</code></pre>", "<pre><code class='language-javascript'>To constantly monitor if the call stack is empty and then invoke any asynchronous functions from the event queue.</code></pre>",
"<pre><code class='language-javascript'>A mechanism to best decide how to terminate any looping structure.</code></pre>" "<pre><code class='language-javascript'>A mechanism to best decide how to terminate any looping structure.</code></pre>"
], ],