chore(i18n,learn): processed translations (#55540)

Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
This commit is contained in:
freeCodeCamp's Camper Bot
2024-07-18 07:29:48 -05:00
committed by GitHub
parent 6f02cba9db
commit 3fcfe897fb
1146 changed files with 2644 additions and 2501 deletions

View File

@@ -19,16 +19,16 @@ When a Rectangle object is created, it should be initialized with `width` and `h
- `get_area`: Returns area (`width * height`)
- `get_perimeter`: Returns perimeter (`2 * width + 2 * height`)
- `get_diagonal`: Returns diagonal (`(width ** 2 + height ** 2) ** .5`)
- `get_picture`: Returns a string that represents the shape using lines of "\*". The number of lines should be equal to the height and the number of "\*" in each line should be equal to the width. There should be a new line (`\n`) at the end of each line. If the width or height is larger than 50, this should return the string: "Too big for picture.".
- `get_picture`: Returns a string that represents the shape using lines of '\*'. The number of lines should be equal to the height and the number of '\*' in each line should be equal to the width. There should be a new line (`\n`) at the end of each line. If the width or height is larger than 50, this should return the string: `'Too big for picture.'`.
- `get_amount_inside`: Takes another shape (square or rectangle) as an argument. Returns the number of times the passed in shape could fit inside the shape (with no rotations). For instance, a rectangle with a width of 4 and a height of 8 could fit in two squares with sides of 4.
Additionally, if an instance of a `Rectangle` is represented as a string, it should look like: `Rectangle(width=5, height=10)`
Additionally, if an instance of a `Rectangle` is represented as a string, it should look like: `'Rectangle(width=5, height=10)'`.
## Square class
The `Square` class should be a subclass of `Rectangle`. When a `Square` object is created, a single side length is passed in. The `__init__` method should store the side length in both the `width` and `height` attributes from the `Rectangle` class.
The `Square` class should be able to access the `Rectangle` class methods but should also contain a `set_side` method. If an instance of a `Square` is represented as a string, it should look like: `Square(side=9)`
The `Square` class should be able to access the `Rectangle` class methods but should also contain a `set_side` method. If an instance of a `Square` is represented as a string, it should look like: `'Square(side=9)'`.
Additionally, the `set_width` and `set_height` methods on the `Square` class should set both the width and height.
@@ -180,7 +180,7 @@ t.result.wasSuccessful()
})
```
The string representation of `Rectangle(3, 6)` should be `Rectangle(width=3, height=6)`.
The string representation of `Rectangle(3, 6)` should be `'Rectangle(width=3, height=6)'`.
```js
({
@@ -215,7 +215,7 @@ t.result.wasSuccessful()
})
```
The string representation of `Square(5)` should be `Square(side=5)`.
The string representation of `Square(5)` should be `'Square(side=5)'`.
```js
({
@@ -646,7 +646,7 @@ t.result.wasSuccessful()
})
```
The `.get_picture()` method should return the string `Too big for picture.` if the `width` or `height` attributes are larger than `50`.
The `.get_picture()` method should return the string `'Too big for picture.'` if the `width` or `height` attributes are larger than `50`.
```js
({

View File

@@ -15,11 +15,11 @@ Here is how you can make a `GET` request with the `fetch()` method:
fetch("url-goes-here")
```
Make a `GET` request to this URL: `https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json`. Don't terminate your code with a semicolon yet.
Make a `GET` request to this URL: `"https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json"`. Don't terminate your code with a semicolon yet.
# --hints--
You should use the `fetch()` method to make a `GET` request to `https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json`.
You should use the `fetch()` method to make a `GET` request to `"https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json"`.
```js
assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)/)

View File

@@ -24,7 +24,7 @@ Again, don't terminate the code with a semicolon yet.
# --hints--
You should use the `fetch()` method to make a `GET` request to `https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json`.
You should use the `fetch()` method to make a `GET` request to `"https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json"`.
```js
assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)/)

View File

@@ -14,7 +14,7 @@ Chain another `.then()` to the existing `.then()` method. This time, pass in `da
# --hints--
You should use the `fetch()` method to make a `GET` request to `https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json`.
You should use the `fetch()` method to make a `GET` request to `"https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json"`.
```js
assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)/)

View File

@@ -15,7 +15,7 @@ Chain `.catch()` to the last `.then()`. Pass in a callback function with `err` a
# --hints--
You should use the `fetch()` method to make a `GET` request to `https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json`.
You should use the `fetch()` method to make a `GET` request to `"https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json"`.
```js
assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)/)

View File

@@ -9,11 +9,11 @@ dashedName: step-12
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.
Also, add a `class` of `user-card` to the `div`.
Also, add a `class` of `"user-card"` to the `div`.
# --hints--
You should create a `div` element with the class `user-card`.
You should create a `div` element with the class `"user-card"`.
```js
displayAuthors([{author: "Kolade"}]);

View File

@@ -9,7 +9,7 @@ dashedName: step-13
Now you need to show some information about the author. First, show the author's name.
Create an `h2` tag with the `class` `author-name`. Then, interpolate `author` inside the `h2` tag. This is the author's name.
Create an `h2` tag with the `class` `"author-name"`. Then, interpolate `author` inside the `h2` tag. This is the author's name.
# --hints--
@@ -21,7 +21,7 @@ displayAuthors([{author: "Kolade"}]);
assert.exists(document.querySelector('#author-container > div > h2'));
```
Your `h2` element should have a class set to `author-name`
Your `h2` element should have a class set to `"author-name"`
```js
displayAuthors([{name: "Jane", height: 12}])

View File

@@ -9,7 +9,7 @@ dashedName: step-15
Now `authorDataArr` is the same as the `data` you logged to the console a while ago. Log `authorDataArr` to the console to confirm this.
Inside your `console.log()` statement, add the text `Author Data Array:` as the first argument and `authorDataArr` as the second argument. Use comma to separate the text from `authorDataArr`.
Inside your `console.log()` statement, add the text `"Author Data Array:"` as the first argument and `authorDataArr` as the second argument. Use comma to separate the text from `authorDataArr`.
# --hints--
@@ -19,13 +19,13 @@ You should assign `data` to the `authorDataArr` variable
assert.match(code, /authorDataArr\s*=\s*data\s*;?/)
```
You should have a console log with the text `Author Data Array:`.
You should have a console log with the text `"Author Data Array:"`.
```js
assert.match(code, /console\.log\(\s*("|'|`)Author\s+Data\s+Array:\s*\1/)
```
You should use comma to separate your `Author Data Array:` text and `authorDataArr`.
You should use comma to separate your `"Author Data Array:"` text and `authorDataArr`.
```js
assert.match(code, /console\.log\(\s*("|'|`)Author\s+Data\s+Array:\s*\1\s*,/)

View File

@@ -7,7 +7,7 @@ dashedName: step-17
# --description--
Now create an image tag and give it the `class` `user-img`. Use template interpolation to set the `src` attribute to `image` you destructured earlier. Set the `alt` attribute to `author` followed by the text `avatar`. Make sure there is a space between the `author` variable and the word `avatar`, for example, `Quincy Larson avatar`.
Now create an image tag and give it the `class` `"user-img"`. Use template interpolation to set the `src` attribute to `image` you destructured earlier. Set the `alt` attribute to `author` followed by the text `"avatar"`. Make sure there is a space between the `author` variable and the word `"avatar"`, for example, `"Quincy Larson avatar"`.
# --hints--
@@ -29,7 +29,7 @@ const retryingTest = (test, message, tries = 20) => {
() => retryingTest(() => document.querySelector('img'), "'img' element not found");
```
Your `img` element should have the class `user-img`.
Your `img` element should have the class `"user-img"`.
```js
assert.include(document.querySelector('img')?.className, "user-img");

View File

@@ -9,7 +9,7 @@ dashedName: step-18
The next thing you'll show are biographical details about the author. You can do this with `bio` that you destructured earlier.
Add a paragraph element with the `class` `bio`, then interpolate `bio` inside the paragraph element.
Add a paragraph element with the `class` `"bio"`, then interpolate `bio` inside the paragraph element.
# --hints--
@@ -20,7 +20,7 @@ You should create a `p` element.
assert.exists(document.querySelector('p'));
```
Your `p` element should have the class `bio`
Your `p` element should have the class `"bio"`
```js
assert.include(document.querySelector('p')?.className, 'bio');

View File

@@ -9,7 +9,7 @@ dashedName: step-19
Next, add a link to the author's page on freeCodeCamp News.
Add an anchor element with the `class` `author-link`, interpolate `url` as the value for the `href` attribute, and set `target` to `_blank`. For the text of the anchor element, interpolate `author` followed by the text `'s author page`. For example, `Quincy Larson's author page`.
Add an anchor element with the `class` `"author-link"`, interpolate `url` as the value for the `href` attribute, and set `target` to `"_blank"`. For the text of the anchor element, interpolate `author` followed by the text `"'s author page"`. For example, `"Quincy Larson's author page"`.
# --hints--
@@ -19,7 +19,7 @@ You should create an anchor element.
assert.exists(document.querySelector('a'));
```
Your anchor element should have the class `author-link`.
Your anchor element should have the class `"author-link"`.
```js
assert.include(document.querySelector('a')?.className, "author-link");
@@ -31,13 +31,13 @@ You should interpolate `url` as the value of your anchor's `href` attribute.
assert.equal(document.querySelector('a')?.getAttribute('href'), authorDataArr[0].url);
```
You should set the `target` attribute of your anchor element to `_blank`.
You should set the `target` attribute of your anchor element to `"_blank"`.
```js
assert.equal(document.querySelector('a')?.getAttribute('target'), '_blank');
```
You should interpolate `author` followed by the text `'s author page` inside your anchor element.
You should interpolate `author` followed by the text `"'s author page"` inside your anchor element.
```js
assert.equal(document.querySelector('a')?.textContent.trim(), `${authorDataArr[0].author}'s author page`);

View File

@@ -9,7 +9,7 @@ dashedName: step-23
Remember that in step 1 you selected the `Load More Authors` button and assigned it to `loadMoreBtn`.
Use `addEventListener` to add a `click` event listener to `loadMoreBtn`. Also, pass in a reference to the `fetchMoreAuthors` function to run whenever the button is clicked.
Use `addEventListener` to add a `"click"` event listener to `loadMoreBtn`. Also, pass in a reference to the `fetchMoreAuthors` function to run whenever the button is clicked.
After that, when you click the button you should see 8 more authors.
@@ -21,7 +21,7 @@ You should call the `addEventListener()` method on your `loadMoreBtn` variable.
assert.match(code, /loadMoreBtn\.addEventListener\(/)
```
Your event listener should listen for a `click` event.
Your event listener should listen for a `"click"` event.
```js
assert.match(code, /loadMoreBtn\.addEventListener\(\s*('|"|`)click\1/)

View File

@@ -7,7 +7,7 @@ dashedName: step-25
# --description--
If this condition is met, disable the button by setting its `disabled` property to `true`. Also, set the `textContent` of the button to `No more data to load`.
If this condition is met, disable the button by setting its `disabled` property to `true`. Also, set the `textContent` of the button to `"No more data to load"`.
# --hints--
@@ -17,7 +17,7 @@ You should set the `disabled` property of `loadMoreBtn` to `true`.
assert.match(code, /loadMoreBtn\.disabled\s*=\s*true\s*;?/)
```
You should set the `textContent` of `loadMoreBtn` to `No more data to load`.
You should set the `textContent` of `loadMoreBtn` to `"No more data to load"`.
```js
assert.match(code, /loadMoreBtn\.textContent\s*=\s*('|"|`)No\s+more\s+data\s+to\s+load\1\s*;?/)

View File

@@ -9,7 +9,7 @@ dashedName: step-26
Next, there's not a lot of separation between each author's name and image, and the rest of the details on the card. A divider will give the author cards a clear visual hierarchy.
Add a `div` element above the author's bio and give it the `class` `purple-divider`.
Add a `div` element above the author's bio and give it the `class` `"purple-divider"`.
# --hints--
@@ -19,7 +19,7 @@ You should create a `div` element before your `p` element.
assert.equal(document.querySelector('p')?.previousElementSibling?.tagName, 'DIV');
```
Your `div` element should have the `class` set to `purple-divider`.
Your `div` element should have the `class` set to `"purple-divider"`.
```js
assert.include(document.querySelector('p')?.previousElementSibling?.className, 'purple-divider');

View File

@@ -7,7 +7,7 @@ dashedName: step-27
# --description--
Some of the author bios are much longer than others. To give the cards a uniform look, you can extract the first 50 characters of each one and replace the rest with an ellipsis (...). Otherwise, you can show the entire bio.
Some of the author bios are much longer than others. To give the cards a uniform look, you can extract the first 50 characters of each one and replace the rest with an ellipsis `("...")`. Otherwise, you can show the entire bio.
Within the paragraph element, replace `bio` with a ternary operator. For the condition, check if the length of `bio` is greater than 50. If it is, use the `.slice()` method to extract the first 50 characters of `bio` and add an ellipsis at the end. Otherwise, show the full `bio`.
@@ -31,7 +31,7 @@ You should check if the length of the `bio` text is greater than `50`.
assert.match(code, /<p\s*class=("|')bio\1>\s*\$\{\s*bio\.length\s*>\s*50/)
```
If the `bio` text is greater than `50` characters, you should extract the first 50 characters with `slice()` and replace the rest with `...`. Don't forget that indexes are zero-based.
If the `bio` text is greater than `50` characters, you should extract the first 50 characters with `slice()` and replace the rest with `"..."`. Don't forget that indexes are zero-based.
```js
assert.match(code, /<p\s*class\s*=\s*("|')bio\1\s*>\s*\$\{\s*bio\.length\s*>\s*50\s*\?\s*(?:bio\.slice\(\s*0\s*,\s*50\s*\)\s*\+\s*("|')\.\.\.\2|`\$\{\s*bio\.slice\(\s*0\s*,\s*50\s*\)\s*\}\.\.\.`)\s*:/);

View File

@@ -9,7 +9,7 @@ dashedName: step-28
Finally, what if there's an error and the author data fail to load? Then we need to show an error in the UI. That's exactly what the `.catch()` method is for handling errors.
Inside the `.catch()`, remove the `console.error()` and set the `innerHTML` of the `authorContainer` to a `p` element with the `class` `error-msg` and text `There was an error loading the authors`.
Inside the `.catch()`, remove the `console.error()` and set the `innerHTML` of the `authorContainer` to a `p` element with the `class` `"error-msg"` and text `"There was an error loading the authors"`.
# --hints--
@@ -26,13 +26,13 @@ You should access the `innerHTML` of `authorContainer` and set it to a `p` eleme
assert.match(code, /authorContainer\.innerHTML\s*=\s*(`|"|')\s*<p.*>.*<\/p>\s*\1/)
```
Your `p` element should have the class `error-msg`.
Your `p` element should have the class `"error-msg"`.
```js
assert.match(code, /(`|"|')\s*<p\s+class\s*=\s*("|')error-msg\2>/)
```
Your `p` element should have the text `There was an error loading the authors`.
Your `p` element should have the text `"There was an error loading the authors"`.
```js
assert.match(code, /(`|"|')<p\s+class\s*=\s*("|')error-msg\2>There\s+was\s+an\s+error\s+loading\s+the\s+authors<\/p>\s*\1\s*;?/)

View File

@@ -7,9 +7,9 @@ dashedName: step-29
# --description--
شيء واحد آخر. If you keep clicking the `Load More Authors` button until there's no more data to load and the text changes to `No more data to load`, the cursor value is still `pointer`. Why not change the cursor value to `not-allowed` instead?
شيء واحد آخر. If you keep clicking the `Load More Authors` button until there's no more data to load and the text changes to `"No more data to load"`, the cursor value is still `pointer`. Why not change the cursor value to `not-allowed` instead?
Access the `style` property of the `Load More Authors` button and set `cursor` to `not-allowed`.
Access the `style` property of the `Load More Authors` button and set `cursor` to `"not-allowed"`.
With that, your author page is complete!
@@ -27,7 +27,7 @@ You should access `cursor` from the `style` property with dot notation.
assert.match(code, /loadMoreBtn\.style\.cursor/)
```
You should set the value of the `cursor` property to `not-allowed`.
You should set the value of the `cursor` property to `"not-allowed"`.
```js
assert.match(code, /loadMoreBtn\.style\.cursor\s*=\s*('|"|`)not\-allowed\1\s*;?/)

View File

@@ -220,8 +220,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -219,8 +219,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -241,8 +241,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -210,8 +210,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -223,8 +223,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -211,8 +211,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -209,8 +209,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -217,8 +217,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -209,8 +209,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -216,8 +216,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -245,8 +245,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -211,8 +211,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -207,8 +207,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -221,8 +221,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -221,8 +221,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -222,8 +222,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -222,8 +222,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -221,8 +221,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -219,8 +219,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -209,8 +209,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -221,8 +221,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -215,8 +215,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -231,8 +231,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -237,8 +237,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -232,8 +232,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -213,8 +213,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -213,8 +213,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -214,8 +214,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -219,8 +219,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -209,8 +209,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -207,8 +207,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -232,8 +232,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -209,8 +209,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -210,8 +210,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -215,8 +215,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -216,8 +216,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -209,8 +209,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -209,8 +209,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -208,8 +208,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -236,8 +236,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -215,8 +215,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -207,8 +207,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -223,8 +223,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -211,8 +211,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -215,8 +215,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -224,8 +224,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -219,8 +219,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -215,8 +215,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -208,8 +208,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -207,8 +207,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -207,8 +207,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -215,8 +215,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -207,8 +207,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -207,8 +207,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -207,8 +207,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -224,8 +224,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -207,8 +207,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -217,8 +217,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -209,8 +209,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -214,8 +214,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -218,8 +218,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -231,8 +231,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -240,8 +240,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -237,8 +237,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -239,8 +239,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -225,8 +225,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -223,8 +223,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -223,8 +223,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -223,8 +223,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -215,8 +215,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -207,8 +207,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -207,8 +207,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -235,8 +235,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -217,8 +217,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -215,8 +215,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -226,8 +226,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -209,8 +209,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -207,8 +207,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -209,8 +209,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -223,8 +223,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -219,8 +219,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}
@@ -648,8 +648,8 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
this.position.x = canvas.width - 2 * this.width;
if (this.position.x >= canvas.width - this.width * 2) {
this.position.x = canvas.width - this.width * 2;
}
}
}

View File

@@ -9,7 +9,7 @@ dashedName: step-33
For the last condition, you will need to check if the player's `x` position has exceeded the right edge of the canvas. If it has, you will need to set the player's `x` position to the maximum value so the player does not accidentally go off screen to the right.
Inside your `update` method, create an `if` statement that checks if `this.position.x >= canvas.width - 2 * this.width`.
Inside your `update` method, create an `if` statement that checks if `this.position.x >= canvas.width - this.width * 2`.
# --hints--
@@ -19,10 +19,10 @@ You should have an `if` statement inside your `update` method.
assert.match(code, /if\s*\(\s*.*\s*\)\s*{/g);
```
Your `if` statement should check if `this.position.x >= canvas.width - 2 * this.width`.
Your `if` statement should check if `this.position.x >= canvas.width - this.width * 2`.
```js
assert.match(code, /if\s*\(\s*this\.position\.x\s*>=\s*canvas\.width\s*-\s*2\s*\*\s*this\.width\s*\)\s*{/gi);
assert.match(code, /if\s*\(\s*this\.position\.x\s*>=\s*canvas\.width\s*-\s*this\.width\s*\*\s*2\s*\)\s*{/gi);
```
# --seed--

View File

@@ -7,16 +7,16 @@ dashedName: step-34
# --description--
Inside your `if` statement, assign `canvas.width - 2 * this.width` to `this.position.x`.
Inside your `if` statement, assign `canvas.width - this.width * 2` to `this.position.x`.
This will ensure that the player's `x` position will never exceed the right edge of the canvas.
# --hints--
You should assign `canvas.width - 2 * this.width` to `this.position.x` inside your `if` statement.
You should assign `canvas.width - this.width * 2` to `this.position.x` inside your `if` statement.
```js
assert.match(code, /this\.position\.x\s*=\s*canvas\.width\s*-\s*2\s*\*\s*this\.width;?/g);
assert.match(code, /this\.position\.x\s*=\s*canvas\.width\s*-\s*this\.width\s*\*\s*2\s*;?/g);
```
# --seed--
@@ -209,7 +209,7 @@ class Player {
this.position.x = this.width;
}
if (this.position.x >= canvas.width - 2 * this.width) {
if (this.position.x >= canvas.width - this.width * 2) {
--fcc-editable-region--
--fcc-editable-region--

Some files were not shown because too many files have changed in this diff Show More