fix: use dfn instead of code tag (#36640)
* Use dfn tags
* remove misused <dfn> tags
* Revert "remove misused <dfn> tags"
This reverts commit b24968a968
.
* Update curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/fill-in-the-blank-with-placeholder-text.english.md
Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
* Make "array" lowercase
Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
* Fix dfn usage
* Address last dfn tags
This commit is contained in:
@ -8,7 +8,7 @@ forumTopicId: 16158
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
We can access the data inside arrays using <code>indexes</code>.
|
||||
We can access the data inside arrays using <dfn>indexes</dfn>.
|
||||
Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array. Like strings, arrays use <dfn>zero-based</dfn> indexing, so the first element in an array is element <code>0</code>.
|
||||
<br />
|
||||
<strong>Example</strong>
|
||||
|
@ -8,8 +8,8 @@ forumTopicId: 16784
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
There are many <dfn>Comparison Operators</dfn> in JavaScript. All of these operators return a boolean <code>true</code> or <code>false</code> value.
|
||||
The most basic operator is the equality operator <code>==</code>. The equality operator compares two values and returns <code>true</code> if they're equivalent or <code>false</code> if they are not. Note that equality is different from assignment (<code>=</code>), which assigns the value at the right of the operator to a variable on the left.
|
||||
There are many <dfn>comparison operators</dfn> in JavaScript. All of these operators return a boolean <code>true</code> or <code>false</code> value.
|
||||
The most basic operator is the equality operator <code>==</code>. The equality operator compares two values and returns <code>true</code> if they're equivalent or <code>false</code> if they are not. Note that equality is different from assignment (<code>=</code>), which assigns the value at the right of the operator to a variable in the left.
|
||||
|
||||
```js
|
||||
function equalityTest(myVal) {
|
||||
@ -21,7 +21,7 @@ function equalityTest(myVal) {
|
||||
```
|
||||
|
||||
If <code>myVal</code> is equal to <code>10</code>, the equality operator returns <code>true</code>, so the code in the curly braces will execute, and the function will return <code>"Equal"</code>. Otherwise, the function will return <code>"Not Equal"</code>.
|
||||
In order for JavaScript to compare two different <code>data types</code> (for example, <code>numbers</code> and <code>strings</code>), it must convert one type to another. This is known as "Type Coercion". Once it does, however, it can compare terms as follows:
|
||||
In order for JavaScript to compare two different <dfn>data types</dfn> (for example, <code>numbers</code> and <code>strings</code>), it must convert one type to another. This is known as "Type Coercion". Once it does, however, it can compare terms as follows:
|
||||
|
||||
```js
|
||||
1 == 1 // true
|
||||
@ -34,7 +34,7 @@ In order for JavaScript to compare two different <code>data types</code> (for ex
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Add the <code>equality operator</code> to the indicated line so that the function will return "Equal" when <code>val</code> is equivalent to <code>12</code>.
|
||||
Add the equality operator to the indicated line so that the function will return "Equal" when <code>val</code> is equivalent to <code>12</code>.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -23,7 +23,7 @@ Like the equality operator, greater than operator will convert data types of val
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Add the <code>greater than</code> operator to the indicated lines so that the return statements make sense.
|
||||
Add the greater than operator to the indicated lines so that the return statements make sense.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -8,7 +8,7 @@ forumTopicId: 16785
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
The <code>greater than or equal to</code> operator (<code>>=</code>) compares the values of two numbers. If the number to the left is greater than or equal to the number to the right, it returns <code>true</code>. Otherwise, it returns <code>false</code>.
|
||||
The greater than or equal to operator (<code>>=</code>) compares the values of two numbers. If the number to the left is greater than or equal to the number to the right, it returns <code>true</code>. Otherwise, it returns <code>false</code>.
|
||||
Like the equality operator, <code>greater than or equal to</code> operator will convert data types while comparing.
|
||||
<strong>Examples</strong>
|
||||
|
||||
@ -23,7 +23,7 @@ Like the equality operator, <code>greater than or equal to</code> operator will
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Add the <code>greater than or equal to</code> operator to the indicated lines so that the return statements make sense.
|
||||
Add the greater than or equal to operator to the indicated lines so that the return statements make sense.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -23,7 +23,7 @@ The <dfn>less than</dfn> operator (<code><</code>) compares the values of two
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Add the <code>less than</code> operator to the indicated lines so that the return statements make sense.
|
||||
Add the less than operator to the indicated lines so that the return statements make sense.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -8,7 +8,7 @@ forumTopicId: 16788
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
The <code>less than or equal to</code> operator (<code><=</code>) compares the values of two numbers. If the number to the left is less than or equal to the number to the right, it returns <code>true</code>. If the number on the left is greater than the number on the right, it returns <code>false</code>. Like the equality operator, <code>less than or equal to</code> converts data types.
|
||||
The less than or equal to operator (<code><=</code>) compares the values of two numbers. If the number to the left is less than or equal to the number to the right, it returns <code>true</code>. If the number on the left is greater than the number on the right, it returns <code>false</code>. Like the equality operator, <code>less than or equal to</code> converts data types.
|
||||
<strong>Examples</strong>
|
||||
|
||||
```js
|
||||
@ -23,7 +23,7 @@ The <code>less than or equal to</code> operator (<code><=</code>) compares th
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Add the <code>less than or equal to</code> operator to the indicated lines so that the return statements make sense.
|
||||
Add the less than or equal to operator to the indicated lines so that the return statements make sense.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -21,7 +21,7 @@ The strict inequality operator (<code>!==</code>) is the logical opposite of the
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Add the <code>strict inequality operator</code> to the <code>if</code> statement so the function will return "Not Equal" when <code>val</code> is not strictly equal to <code>17</code>
|
||||
Add the strict inequality operator to the <code>if</code> statement so the function will return "Not Equal" when <code>val</code> is not strictly equal to <code>17</code>
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -9,7 +9,7 @@ forumTopicId: 18219
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can run the same code multiple times by using a loop.
|
||||
The most common type of JavaScript loop is called a <code>for loop</code> because it runs "for" a specific number of times.
|
||||
The most common type of JavaScript loop is called a <code>for</code> loop because it runs "for" a specific number of times.
|
||||
For loops are declared with three optional expressions separated by semicolons:
|
||||
<code>for ([initialization]; [condition]; [final-expression])</code>
|
||||
The <code>initialization</code> statement is executed one time only before the loop starts. It is typically used to define and setup your loop variable.
|
||||
|
@ -8,7 +8,7 @@ forumTopicId: 18247
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
You can also nest arrays within other arrays, like this: <code>[["Bulls", 23], ["White Sox", 45]]</code>. This is also called a <dfn>Multi-dimensional Array<dfn>.
|
||||
You can also nest arrays within other arrays, like this: <code>[["Bulls", 23], ["White Sox", 45]]</code>. This is also called a <dfn>multi-dimensional arrray<dfn>.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
|
@ -28,7 +28,7 @@ typeof '3' // returns 'string'
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
The <code>compareEquality</code> function in the editor compares two values using the <code>equality operator</code>. Modify the function so that it returns "Equal" only when the values are strictly equal.
|
||||
The <code>compareEquality</code> function in the editor compares two values using the equality operator. Modify the function so that it returns "Equal" only when the values are strictly equal.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -8,14 +8,14 @@ forumTopicId: 18341
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
<code>Bracket notation</code> is a way to get a character at a specific <code>index</code> within a string.
|
||||
<dfn>Bracket notation</dfn> is a way to get a character at a specific <code>index</code> within a string.
|
||||
Most modern programming languages, like JavaScript, don't start counting at 1 like humans do. They start at 0. This is referred to as <dfn>Zero-based</dfn> indexing.
|
||||
For example, the character at index 0 in the word "Charles" is "C". So if <code>var firstName = "Charles"</code>, you can get the value of the first letter of the string by using <code>firstName[0]</code>.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Use <dfn>bracket notation</dfn> to find the first character in the <code>lastName</code> variable and assign it to <code>firstLetterOfLastName</code>.
|
||||
Use bracket notation to find the first character in the <code>lastName</code> variable and assign it to <code>firstLetterOfLastName</code>.
|
||||
<strong>Hint</strong><br>Try looking at the <code>firstLetterOfFirstName</code> variable declaration if you get stuck.
|
||||
</section>
|
||||
|
||||
|
@ -8,7 +8,7 @@ forumTopicId: 301179
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
In the previous challenge, you used a single <code>conditional operator</code>. You can also chain them together to check for multiple conditions.
|
||||
In the previous challenge, you used a single conditional operator. You can also chain them together to check for multiple conditions.
|
||||
The following function uses if, else if, and else statements to check multiple conditions:
|
||||
|
||||
```js
|
||||
@ -25,7 +25,7 @@ function findGreaterOrEqual(a, b) {
|
||||
}
|
||||
```
|
||||
|
||||
The above function can be re-written using multiple <code>conditional operators</code>:
|
||||
The above function can be re-written using multiple conditional operators:
|
||||
|
||||
```js
|
||||
function findGreaterOrEqual(a, b) {
|
||||
@ -35,7 +35,7 @@ function findGreaterOrEqual(a, b) {
|
||||
}
|
||||
```
|
||||
|
||||
However, this should be used with care as using multiple <code>conditional operators</code> without proper indentation may make your code hard to read. For example:
|
||||
However, this should be used with care as using multiple conditional operators without proper indentation may make your code hard to read. For example:
|
||||
|
||||
```js
|
||||
function findGreaterOrEqual(a, b) {
|
||||
@ -47,7 +47,7 @@ function findGreaterOrEqual(a, b) {
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Use multiple <code>conditional operators</code> in the <code>checkSign</code> function to check if a number is positive, negative or zero. The function should return "positive", "negative" or "zero".
|
||||
Use multiple conditional operators in the <code>checkSign</code> function to check if a number is positive, negative or zero. The function should return "positive", "negative" or "zero".
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -55,7 +55,7 @@ Use multiple <code>conditional operators</code> in the <code>checkSign</code> fu
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>checkSign</code> should use multiple <code>conditional operators</code>
|
||||
- text: <code>checkSign</code> should use multiple conditional operators
|
||||
testString: assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code));
|
||||
- text: <code>checkSign(10)</code> should return "positive". Note that capitalization matters
|
||||
testString: assert(checkSign(10) === 'positive');
|
||||
|
Reference in New Issue
Block a user