jiebi/CodeConvo huggingface dataset:
import React from 'react'; <del> import { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons'; </del> <ins> import { faWindowRestore } from '@fortawesome/free-solid-svg-icons'; </ins> import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { useTranslation } from 'react-i18next'; import EditorTabs from './editor-tabs';
```js function whatIsInAName(collection, source) { <del> const arr = []; // Only change code below this line // Only change code above this line return arr; </del> } whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
Moving on to the final `fieldset`. What if you wanted to allow a user to upload a profile picture? <del> Well, the `input` type `file` allows just that. Add a `label` with the text `Upload a profile picture: `, and add an `input` accepting a file upload. </del> <ins> Well, the `input` type `file` allows just that. Add a `label` with the text `Upload a profile picture: `, and nest an `input` accepting a file upload. </ins> # --hints--
# --description-- <del> After your last `.divider`, create a new `p` element with the text `Cholesterol 0mg 0%`. Wrap the text `Cholesterol` in a `span` element, and give that `span` element the `class` attribute set to `bold`. Wrap the text `0%` in another `span` element, with the `class` set to `bold`. Finally, nest the `Cholesterol` and `0mg` span elements inside an additional span element for alignment. </del> <ins> After your last `.divider`, create a new `p` element with the text `Cholesterol 0mg 0%`. Wrap the text `Cholesterol` in a `span` element, and give that `span` element the `class` attribute set to `bold`. Wrap the text `0%` in another `span` element, with the `class` set to `bold`. Finally, nest the `Cholesterol` and `0mg` `span` elements inside an additional `span` element for alignment. </ins> # --hints--
You are provided sentences with some missing words, like nouns, verbs, adjectives and adverbs. You then fill in the missing pieces with words of your choice in a way that the completed sentence makes sense. <del> Consider this sentence - It was really **____**, and we **____** ourselves **____**. This sentence has three missing pieces- an adjective, a verb and an adverb, and we can add words of our choice to complete it. We can then assign the completed sentence to a variable as follows: </del> <ins> Consider this sentence: ```md It was really ____, and we ____ ourselves ____. ``` This sentence has three missing pieces- an adjective, a verb and an adverb, and we can add words of our choice to complete it. We can then assign the completed sentence to a variable as follows: </ins> ```js const sentence = "It was really " + "hot" + ", and we " + "laughed" + " ourselves " + "silly" + ".";
-   Your function must always return the entire `records` object. -   If `value` is an empty string, delete the given `prop` property from the album. -   If `prop` isn't `tracks` and `value` isn't an empty string, assign the `value` to that album's `prop`. <del> -   If `prop` is `tracks` and value isn't an empty string, add the `value` to the end of the album's `tracks` array. You need to create this array first if the album does not have a `tracks` property. </del> <ins> -   If `prop` is `tracks` and `value` isn't an empty string, you need to update the album's `tracks` array. First, if the album does not have a `tracks` property, assign it an empty array. Then add the `value` as the last item in the album's `tracks` array. </ins> **Note:** A copy of the `recordCollection` object is used for the tests. You should not directly modify the `recordCollection` object.
```js switch (expression) { case 1: <del> /* this code will execute if the case matches the expression */ </del> <ins> console.log("1"); </ins> break; default: <del> /* the default will execute if none of the other cases match the expression */ </del> <ins> console.log("Not 1"); </ins> } ``` <ins> In this example, the first `case` checks if `expression === 1`, and if so logs `1` to the console. If no cases are true, it will log `Not 1` to the console. The `break` statement stops execution of the `switch` when the `case` is true. </ins> Add a `switch` statement and use `e.target.value` for the expression. # --hints--
| --------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------- | | [Node.js](http://nodejs.org)                                                                  | `18.x`  | We use the "Active LTS" version, See [LTS Schedule](https://nodejs.org/en/about/releases/). | | [pnpm](https://pnpm.io/installation)                                                          | `8.x`   | -                                                                                            | <del> | [MongoDB Community Server](https://docs.mongodb.com/manual/administration/install-community/) | `4.2.x` | -                                                                                           | </del> <ins> | [MongoDB Community Server](https://docs.mongodb.com/manual/administration/install-community/) | `5.0.x` | -                                                                                           | </ins> > [!ATTENTION] > If you have a different version, please install the recommended version. We can only support installation issues for recommended versions. See [troubleshooting](#troubleshooting) for details.
`Thermostat` should be a `class` with a defined `constructor` method. ```js <del> assert( typeof Thermostat === 'function' && typeof Thermostat.constructor === 'function' ); </del> <ins> assert.isFunction(Thermostat); assert.isFunction(Thermostat?.constructor); </ins> ``` <del> `class` keyword should be used. </del> <ins> The `class` keyword should be used. </ins> ```js <del> assert(code.match(/class/g)); </del> <ins> assert.match(code, /class/); </ins> ``` `Thermostat` should be able to be instantiated. ```js <del> assert( (() => { const t = new Thermostat(122); return typeof t === 'object'; })() ); </del> <ins> const _t = new Thermostat(122); assert.isObject(_t); </ins> ``` When instantiated with a Fahrenheit value, `Thermostat` should set the correct `temperature`. ```js <del> assert( (() => { const t = new Thermostat(122); return t.temperature === 50; })() ); </del> <ins> const _t = new Thermostat(122); assert.strictEqual(_t?.temperature, 50); </ins> ``` A `getter` should be defined. ```js <del> assert( (() => { const desc = Object.getOwnPropertyDescriptor( Thermostat.prototype, 'temperature' ); return !!desc && typeof desc.get === 'function'; })() ); </del> <ins> const _desc = Object.getOwnPropertyDescriptor(Thermostat.prototype, 'temperature'); assert.isFunction(_desc?.get); </ins> ``` A `setter` should be defined. ```js <del> assert( (() => { const desc = Object.getOwnPropertyDescriptor( Thermostat.prototype, 'temperature' ); return !!desc && typeof desc.set === 'function'; })() ); </del> <ins> const _desc = Object.getOwnPropertyDescriptor(Thermostat.prototype, 'temperature'); assert.isFunction(_desc?.set); </ins> ``` Calling the `setter` with a Celsius value should set the `temperature`. ```js <del> assert( (() => { const t = new Thermostat(32); t.temperature = 26; const u = new Thermostat(32); u.temperature = 50; return t.temperature === 26 && u.temperature === 50; })() ); </del> <ins> const _t = new Thermostat(32); _t.temperature = 26; const _u = new Thermostat(32); _u.temperature = 50; assert.approximately(_t.temperature, 26, 0.1); assert.approximately(_u.temperature, 50, 0.1); </ins> ``` # --seed--
assert(document.querySelector('tbody')?.querySelectorAll('tr')?.[3]?.querySelectorAll('td')?.[2]?.textContent === '$809'); ``` <ins> Your third `td` element should have the `class` attribute set to `current`. ```js assert(document.querySelector('tbody')?.querySelectorAll('tr')?.[3]?.querySelectorAll('td')?.[2]?.classList?.contains('current')); ``` </ins> # --seed-- ## --seed-contents--
<Spacer size='medium' /> <h2>{t('learn.fill-in-the-blank')}</h2> <Spacer size='small' /> <del> <ObserveKeys> </del> <ins> {/* what we want to observe is ctrl/cmd + enter, but ObserveKeys is buggy and throws an error if it encounters a key combination, so we have to pass in the individual keys to observe */} <ObserveKeys only={['ctrl', 'cmd', 'enter']}> </ins> <div> <p> {splitSentence.map((s, i) => {
Your `for` loop should `push` `strArray[i]` to `cleanStrArray`. ```js <del> assert.match(code, /fors*(s*(let|var)s+is*=s*0s*;s*is*<s*strArray.lengths*;s*is*++s*)s*{s*ifs*(![("|')+2s*,s*("|')-3s*,s*("|')s4s*].includes(s*strArray[i]s*))s*{s*cleanStrArray.push(s*strArray[i]s*)s*}/); </del> <ins> assert.match(code, /fors*(s*(let|var)s+is*=s*0s*;s*is*<s*strArray.lengths*;s*is*++s*)s*{s*ifs*(![("|')+2s*,s*("|')-3s*,s*("|')s4s*].includes(s*strArray[i]s*))s*{s*cleanStrArray.push(s*strArray[i]s*)s*;?s*}/); </ins> ``` # --seed--
You should add an `else` block to the existing `if` block. ```js <del> assert.match(code, /ifs*(userData?.currentSongs*===s*nulls*||s*userData?.currentSong.ids*!==s*song.id)s*{s*audio.currentTimes*=s*0;?s*}s*elses{/) </del> <ins> assert.match(code, /ifs*(userData?.currentSongs*===s*nulls*||s*userData?.currentSong.ids*!==s*song.id)s*{s*audio.currentTimes*=s*0;?s*}s*elses*{/) </ins> ``` You should set `audio.currentTime` to `userData.songCurrentTime` inside the `else` block of your `if` statement. ```js <del> assert.match(code, /ifs*(userData?.currentSongs*===s*nulls*||s*userData?.currentSong.ids*!==s*song.id)s*{s*audio.currentTimes*=s*0;?s*}s*elses{s*audio.currentTimes*=s*userData.songCurrentTime;?s*}/) </del> <ins> assert.match(code, /ifs*(userData?.currentSongs*===s*nulls*||s*userData?.currentSong.ids*!==s*song.id)s*{s*audio.currentTimes*=s*0;?s*}s*elses*{s*audio.currentTimes*=s*userData.songCurrentTime;?s*}/) </ins> ``` # --seed--
dashedName: task-55 --- <del> <!-- (audio) Tom: Those are great traits for someone in her position, I think. What does she do as our team lead? --> </del> <ins> <!-- (audio) Tom: Those are great traits for someone in her position, I think. What does she do as the team lead? --> </ins> # --description-- <del> Now you will practice listening for the correct form of `do.` Listen carefully to how Tom asks about Maria's job as a team lead. </del> <ins> Now you will practice listening for the correct form of `do`. Listen carefully to how Tom asks about Maria's job as a team lead. </ins> # --instructions--
Pass in only the first element of the `locations` array by adding `[0]` at the end of the variable. For example: `myFunction(arg[0]);`. <del> This is called <dfn>bracket notation</dfn>. Values in an array are accessed by index. Indices are numerical values and start at 0 - this is called zero-based indexing. `arg[0]` would be the first element in the `arg` array. </del> <ins> This is called <dfn>bracket notation</dfn>. Values in an array are accessed by index. Indices are numerical values and start at `0` - this is called zero-based indexing. `arg[0]` would be the first element in the `arg` array. </ins> # --hints--
The attack of the monster will be based on the monster's `level` and the player's `xp`. In the `getMonsterAttackValue` function, use `const` to create a variable called `hit`. Assign it the equation `(level * 5) - (Math.floor(Math.random() * xp));`. <del> This will set the monster's attack to five times their `level` minus a random number between 0 and the player's `xp`. </del> <ins> This will set the monster's attack to five times their `level` minus a random number between `0` and the player's `xp`. </ins> # --hints--
You should use the concatenation operator on your `result` variable. ```js <del> assert.match(code, /results*+/); </del> <ins> assert.match(code, /(?:results*+|+s*result)/); </ins> ``` You should concatenate `row` to your `result` variable. ```js <del> assert.match(code, /results*+s*row/); </del> <ins> assert.match(code, /results*+s*row|rows*+s*result/); </ins> ``` You should assign the result of your concatenation back to the `result` variable. ```js <del> assert.match(code, /results*=s*results*+s*row;?/) </del> <ins> assert.match(code, /results*=s*(results*+s*row|rows*+s*result);?/); </ins> ``` # --seed--
```js const afterCalculateTotal = code.split('calculateTotal')[1]; <del> assert.match(afterCalculateTotal, /(s*totals*,s*items*)s*=>s*totals*+s*item.price/); </del> <ins> assert.match(afterCalculateTotal, /(s*totals*,s*items*)s*=>s*(?:totals*+s*item.price|item.prices*+s*total)/); </ins> ``` Your `reduce` call should have an initial value of `0`. ```js const afterCalculateTotal = code.split('calculateTotal')[1]; <del> assert.match(afterCalculateTotal, /thiss*.s*itemss*.s*reduces*(s*(s*totals*,s*items*)s*=>s*totals*+s*item.prices*,s*0s*)/); </del> <ins> assert.match(afterCalculateTotal, /thiss*.s*itemss*.s*reduces*(s*(s*totals*,s*items*)s*=>s*(?:totals*+s*item.price|item.prices*+s*total)s*,s*0s*)/); </ins> ``` # --seed--
# --description-- <del> You used the `inputVal` property as the `id` attribute for your paragraph elements. Now you can target those the paragraph elements with those `id`s. </del> <ins> You have set the `id` attribute for your paragraph elements to the `obj.inputVal` property. </ins> <del> Use the `.getElementById()` method to select the element with the `id` attribute with the value of the `inputVal` property of the current object. </del> <ins> Now, use `getElementById` to select the element with that attribute value, again using the `obj.inputVal` property. </ins> # --hints--
assert.match(calculateCalories.toString(), /document.querySelectorAll(s*('|")#breakfast input[s*type=numbers*]s*1s*)/); ``` <del> You should assign the result of your `odocument.querySelectorAll()` call to `breakfastNumberInputs`. </del> <ins> You should assign the result of your `document.querySelectorAll()` call to `breakfastNumberInputs`. </ins> ```js assert.match(calculateCalories.toString(), /breakfastNumberInputss*=s*document.querySelectorAll(s*('|")#breakfast input[s*type=numbers*]s*1s*)/);
# --description-- <del> You have accessed elements (characters) of a string before, using the index operator `[]`. You can also use the index operator to access a range of characters in a string with `string[x:y:h]`: </del> <ins> You have accessed elements (characters) of a string before, using the index operator `[]`. You can also use the index operator to access a range of characters in a string with `string[start:stop:step]`: </ins> ```python my_string = 'camperbot' <del> camper = my_string[0:6] cp = my_string[0:6:3] </del> <ins> my_string[0:6] == 'camper' # True my_string[0:6:3] == 'cp' # True </ins> ``` <del> Where `x` is the starting index, `y` is the ending index, and `h` is the step (the amount of characters to skip over). </del> <ins> Where `start` is the starting index (inclusive), `stop` is the ending index (exclusive), and `step` is the amount of characters to skip over. If not specified, `step` is default to 1. </ins> Create a variable named `card_number_reversed` and assign it the value of the first 4 characters of `card_number`.
assert.match(code, /taskData.forEach(s*/) ``` <del> You should destructure `id`, `title`, `date`, `description` as the parameters of the callback of your `forEach()`. </del> <ins> You should use `{id, title, date, description}` as the destructured parameters of the `forEach()` callback function. </ins> ```js assert.match(code, /taskData.forEach(s*(s*{s*(?:ids*,s*titles*,s*dates*,s*description)|(?:titles*,s*ids*,s*dates*,s*description)|(?:dates*,s*ids*,s*titles*,s*description)|(?:ids*,s*dates*,s*titles*,s*description)|(?:titles*,s*dates*,s*ids*,s*description)|(?:dates*,s*titles*,s*ids*,s*description)|(?:dates*,s*titles*,s*descriptions*,s*id)|(?:titles*,s*dates*,s*descriptions*,s*id)|(?:descriptions*,s*dates*,s*titles*,s*id)|(?:dates*,s*descriptions*,s*titles*,s*id)|(?:titles*,s*descriptions*,s*dates*,s*id)|(?:descriptions*,s*titles*,s*dates*,s*id)|(?:descriptions*,s*ids*,s*dates*,s*title)|(?:ids*,s*descriptions*,s*dates*,s*title)|(?:dates*,s*descriptions*,s*ids*,s*title)|(?:descriptions*,s*dates*,s*ids*,s*title)|(?:ids*,s*dates*,s*descriptions*,s*title)|(?:dates*,s*ids*,s*descriptions*,s*title)|(?:titles*,s*ids*,s*descriptions*,s*date)|(?:ids*,s*titles*,s*descriptions*,s*date)|(?:descriptions*,s*titles*,s*ids*,s*date)|(?:titles*,s*descriptions*,s*ids*,s*date)|(?:ids*,s*descriptions*,s*titles*,s*date)|(?:descriptions*,s*ids*,s*titles*,s*date)s*}/)
</Table> )} {id && ( <del> <Modal onClose={closeSolution} open={solutionOpen}> </del> <ins> <Modal onClose={closeSolution} open={solutionOpen} size='large'> </ins> <Modal.Header showCloseButton={true} closeButtonClassNames='close'> {`${username}'s Solution to ${ idToNameMap.get(id)?.challengeTitle ?? '' }`} </Modal.Header> <del> <Modal.Body> </del> <ins> <Modal.Body alignment='left'> </ins> <SolutionViewer challengeFiles={challengeData.challengeFiles} solution={challengeData.solution ?? ''}
assert.strictEqual(scoreSpans[3].innerText, ", score = 30"); ``` <del> If a large straight is rolled, your `checkForStraights` function should enable the fifth radio button, set the value to `40`, and update the displayed text to `, score = 0`. </del> <ins> If a large straight is rolled, your `checkForStraights` function should enable the fifth radio button, set the value to `40`, and update the displayed text to `, score = 40`. </ins> ```js resetRadioOptions();
# --description-- <del> Inside the template literal, create a `div` element with the `id` set to the `index` from the `.forEach()` array method. Remember to use template interpolation to do this. </del> <ins> Inside the template literal, create a `div` element with the `id` set to the `index` from the `.forEach()` array method. Remember to use string interpolation to do this. </ins> Also, add a `class` of `"user-card"` to the `div`.
assert.include(document.querySelector('#author-container > div')?.className, 'user-card'); ``` <del> Your `div` element should have the `id` of `index`. Remember to use template interpolation to set the `id`. </del> <ins> Your `div` element should have the `id` of `index`. Remember to use string interpolation to set the `id`. </ins> ```js displayAuthors([{author: "Naomi"}]);