|
414 | 414 | "<blockquote>FBPosts.filter((post) => post.thumbnail !== null && post.shares > 100 && post.likes > 500)</blockquote>", |
415 | 415 | "This code is more succinct and accomplishes the same task with fewer lines of code.", |
416 | 416 | "<hr>", |
417 | | - "Use arrow function syntax to compute the square of only the positive integers (fractions are not integers) in the array <code>realNumberArray</code> and store the new array in the variable <code>squaredIntegers</code>." |
| 417 | + "Use arrow function syntax to compute the square of only the positive integers (decimal numbers are not integers) in the array <code>realNumberArray</code> and store the new array in the variable <code>squaredIntegers</code>." |
418 | 418 | ], |
419 | 419 | "tests": [ |
420 | 420 | { |
421 | | - "text": "User did replace <code>var</code> keyword.", |
422 | | - "testString": "getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace <code>var</code> keyword.');" |
423 | | - }, |
424 | | - { |
425 | | - "text": "<code>squaredIntegers</code> should be a constant variable (by using <code>const</code>).", |
426 | | - "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+squaredIntegers/g), '<code>squaredIntegers</code> should be a constant variable (by using <code>const</code>).');" |
| 421 | + "text": |
| 422 | + "<code>squaredIntegers</code> should be a constant variable (by using <code>const</code>).", |
| 423 | + "testString": |
| 424 | + "getUserInput => assert(getUserInput('index').match(/const\\s+squaredIntegers/g), '<code>squaredIntegers</code> should be a constant variable (by using <code>const</code>).');" |
427 | 425 | }, |
428 | 426 | { |
429 | 427 | "text": "<code>squaredIntegers</code> should be an <code>array</code>", |
430 | 428 | "testString": "assert(Array.isArray(squaredIntegers), '<code>squaredIntegers</code> should be an <code>array</code>');" |
431 | 429 | }, |
432 | 430 | { |
433 | | - "text": "<code>squaredIntegers</code> should be <code>[16, 1764, 36]</code>", |
434 | | - "testString": "assert(squaredIntegers[0] === 16 && squaredIntegers[1] === 1764 && squaredIntegers[2] === 36, '<code>squaredIntegers</code> should be <code>[16, 1764, 36]</code>');" |
| 431 | + "text": |
| 432 | + "<code>squaredIntegers</code> should be <code>[16, 1764, 36]</code>", |
| 433 | + "testString": |
| 434 | + "assert.deepStrictEqual(squaredIntegers, [16, 1764, 36], '<code>squaredIntegers</code> should be <code>[16, 1764, 36]</code>');" |
435 | 435 | }, |
436 | 436 | { |
437 | 437 | "text": "<code>function</code> keyword was not used.", |
|
455 | 455 | "ext": "js", |
456 | 456 | "name": "index", |
457 | 457 | "contents": [ |
458 | | - "const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34];", |
| 458 | + "const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2];", |
459 | 459 | "const squareList = (arr) => {", |
460 | 460 | " \"use strict\";", |
461 | 461 | " // change code below this line", |
|
0 commit comments