chore(curriculum): update asserts in legacy basic algorithm scripting (#57784)

Co-authored-by: Naomi <accounts+github@nhcarrigan.com>
This commit is contained in:
Anna
2025-01-04 07:10:00 -05:00
committed by GitHub
parent 52dd67a949
commit 6fa282cb6f
15 changed files with 175 additions and 149 deletions

View File

@@ -17,61 +17,61 @@ Boolean primitives are `true` and `false`.
`booWho(true)` should return `true`.
```js
assert.strictEqual(booWho(true), true);
assert.isTrue(booWho(true));
```
`booWho(false)` should return `true`.
```js
assert.strictEqual(booWho(false), true);
assert.isTrue(booWho(false));
```
`booWho([1, 2, 3])` should return `false`.
```js
assert.strictEqual(booWho([1, 2, 3]), false);
assert.isFalse(booWho([1, 2, 3]));
```
`booWho([].slice)` should return `false`.
```js
assert.strictEqual(booWho([].slice), false);
assert.isFalse(booWho([].slice));
```
`booWho({ "a": 1 })` should return `false`.
```js
assert.strictEqual(booWho({ a: 1 }), false);
assert.isFalse(booWho({ a: 1 }));
```
`booWho(1)` should return `false`.
```js
assert.strictEqual(booWho(1), false);
assert.isFalse(booWho(1));
```
`booWho(NaN)` should return `false`.
```js
assert.strictEqual(booWho(NaN), false);
assert.isFalse(booWho(NaN));
```
`booWho("a")` should return `false`.
```js
assert.strictEqual(booWho('a'), false);
assert.isFalse(booWho('a'));
```
`booWho("true")` should return `false`.
```js
assert.strictEqual(booWho('true'), false);
assert.isFalse(booWho('true'));
```
`booWho("false")` should return `false`.
```js
assert.strictEqual(booWho('false'), false);
assert.isFalse(booWho('false'));
```
# --seed--
@@ -90,7 +90,7 @@ booWho(null);
```js
function booWho(bool) {
return typeof bool === "boolean";
return typeof bool === 'boolean';
}
booWho(null);

View File

@@ -90,7 +90,7 @@ function chunkArrayInGroups(arr, size) {
return arr;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
chunkArrayInGroups(['a', 'b', 'c', 'd'], 2);
```
# --solutions--
@@ -106,5 +106,5 @@ function chunkArrayInGroups(arr, size) {
return out;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
chunkArrayInGroups(['a', 'b', 'c', 'd'], 2);
```

View File

@@ -10,84 +10,85 @@ dashedName: confirm-the-ending
Check if a string (first argument, `str`) ends with the given target string (second argument, `target`).
This challenge *can* be solved with the `.endsWith()` method, which was introduced in ES2015. But for the purpose of this challenge, we would like you to use one of the JavaScript substring methods instead.
This challenge _can_ be solved with the `.endsWith()` method, which was introduced in ES2015. But for the purpose of this challenge, we would like you to use one of the JavaScript substring methods instead.
# --hints--
`confirmEnding("Bastian", "n")` should return `true`.
```js
assert(confirmEnding('Bastian', 'n') === true);
assert.isTrue(confirmEnding('Bastian', 'n'));
```
`confirmEnding("Congratulation", "on")` should return `true`.
```js
assert(confirmEnding('Congratulation', 'on') === true);
assert.isTrue(confirmEnding('Congratulation', 'on'));
```
`confirmEnding("Connor", "n")` should return `false`.
```js
assert(confirmEnding('Connor', 'n') === false);
assert.isFalse(confirmEnding('Connor', 'n'));
```
`confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification")` should return `false`.
```js
assert(
assert.isFalse(
confirmEnding(
'Walking on water and developing software from a specification are easy if both are frozen',
'specification'
) === false
)
);
```
`confirmEnding("He has to give me a new name", "name")` should return `true`.
```js
assert(confirmEnding('He has to give me a new name', 'name') === true);
assert.isTrue(confirmEnding('He has to give me a new name', 'name'));
```
`confirmEnding("Open sesame", "same")` should return `true`.
```js
assert(confirmEnding('Open sesame', 'same') === true);
assert.isTrue(confirmEnding('Open sesame', 'same'));
```
`confirmEnding("Open sesame", "sage")` should return `false`.
```js
assert(confirmEnding('Open sesame', 'sage') === false);
assert.isFalse(confirmEnding('Open sesame', 'sage'));
```
`confirmEnding("Open sesame", "game")` should return `false`.
```js
assert(confirmEnding('Open sesame', 'game') === false);
assert.isFalse(confirmEnding('Open sesame', 'game'));
```
`confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")` should return `false`.
```js
assert(
assert.isFalse(
confirmEnding(
'If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing',
'mountain'
) === false
)
);
```
`confirmEnding("Abstraction", "action")` should return `true`.
```js
assert(confirmEnding('Abstraction', 'action') === true);
assert.isTrue(confirmEnding('Abstraction', 'action'));
```
Your code should not use the built-in method `.endsWith()` to solve the challenge.
```js
assert(!/\.endsWith\(.*?\)\s*?;?/.test(__helpers.removeJSComments(code)) && !/\['endsWith'\]/.test(__helpers.removeJSComments(code)));
assert.notMatch(__helpers.removeJSComments(code), /\.endsWith\(.*?\)\s*?;?/);
assert.notMatch(__helpers.removeJSComments(code), /\['endsWith'\]/);
```
# --seed--
@@ -99,7 +100,7 @@ function confirmEnding(str, target) {
return str;
}
confirmEnding("Bastian", "n");
confirmEnding('Bastian', 'n');
```
# --solutions--
@@ -109,5 +110,5 @@ function confirmEnding(str, target) {
return str.substring(str.length - target.length) === target;
}
confirmEnding("Bastian", "n");
confirmEnding('Bastian', 'n');
```

View File

@@ -17,37 +17,37 @@ You are given a variable `celsius` representing a temperature in Celsius. Use th
`convertCtoF(0)` should return a number
```js
assert(typeof convertCtoF(0) === 'number');
assert.isNumber(convertCtoF(0));
```
`convertCtoF(-30)` should return a value of `-22`
```js
assert(convertCtoF(-30) === -22);
assert.strictEqual(convertCtoF(-30), -22);
```
`convertCtoF(-10)` should return a value of `14`
```js
assert(convertCtoF(-10) === 14);
assert.strictEqual(convertCtoF(-10), 14);
```
`convertCtoF(0)` should return a value of `32`
```js
assert(convertCtoF(0) === 32);
assert.strictEqual(convertCtoF(0), 32);
```
`convertCtoF(20)` should return a value of `68`
```js
assert(convertCtoF(20) === 68);
assert.strictEqual(convertCtoF(20), 68);
```
`convertCtoF(30)` should return a value of `86`
```js
assert(convertCtoF(30) === 86);
assert.strictEqual(convertCtoF(30), 86);
```
# --seed--
@@ -67,7 +67,7 @@ convertCtoF(30);
```js
function convertCtoF(celsius) {
let fahrenheit = celsius * 9/5 + 32;
let fahrenheit = celsius * (9 / 5) + 32;
return fahrenheit;
}

View File

@@ -23,31 +23,31 @@ Only integers greater than or equal to zero will be supplied to the function.
`factorialize(5)` should return a number.
```js
assert(typeof factorialize(5) === 'number');
assert.isNumber(factorialize(5));
```
`factorialize(5)` should return `120`.
```js
assert(factorialize(5) === 120);
assert.strictEqual(factorialize(5), 120);
```
`factorialize(10)` should return `3628800`.
```js
assert(factorialize(10) === 3628800);
assert.strictEqual(factorialize(10), 3628800);
```
`factorialize(20)` should return `2432902008176640000`.
```js
assert(factorialize(20) === 2432902008176640000);
assert.strictEqual(factorialize(20), 2432902008176640000);
```
`factorialize(0)` should return `1`.
```js
assert(factorialize(0) === 1);
assert.strictEqual(factorialize(0), 1);
```
# --seed--

View File

@@ -45,7 +45,7 @@ You should not mutate `arr`.
```js
const arr = ['a', false, 0, 'Naomi'];
bouncer(arr);
assert.deepEqual(arr, ['a', false, 0, 'Naomi'])
assert.deepEqual(arr, ['a', false, 0, 'Naomi']);
```
# --seed--
@@ -57,7 +57,7 @@ function bouncer(arr) {
return arr;
}
bouncer([7, "ate", "", false, 9]);
bouncer([7, 'ate', '', false, 9]);
```
# --solutions--
@@ -67,5 +67,5 @@ function bouncer(arr) {
return arr.filter(e => e);
}
bouncer([7, "ate", "", false, 9]);
bouncer([7, 'ate', '', false, 9]);
```

View File

@@ -17,50 +17,51 @@ Your response should be a number.
`findLongestWordLength("The quick brown fox jumped over the lazy dog")` should return a number.
```js
assert(
typeof findLongestWordLength(
'The quick brown fox jumped over the lazy dog'
) === 'number'
assert.isNumber(
findLongestWordLength('The quick brown fox jumped over the lazy dog')
);
```
`findLongestWordLength("The quick brown fox jumped over the lazy dog")` should return `6`.
```js
assert(
findLongestWordLength('The quick brown fox jumped over the lazy dog') === 6
assert.strictEqual(
findLongestWordLength('The quick brown fox jumped over the lazy dog'),
6
);
```
`findLongestWordLength("May the force be with you")` should return `5`.
```js
assert(findLongestWordLength('May the force be with you') === 5);
assert.strictEqual(findLongestWordLength('May the force be with you'), 5);
```
`findLongestWordLength("Google do a barrel roll")` should return `6`.
```js
assert(findLongestWordLength('Google do a barrel roll') === 6);
assert.strictEqual(findLongestWordLength('Google do a barrel roll'), 6);
```
`findLongestWordLength("What is the average airspeed velocity of an unladen swallow")` should return `8`.
```js
assert(
assert.strictEqual(
findLongestWordLength(
'What is the average airspeed velocity of an unladen swallow'
) === 8
),
8
);
```
`findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")` should return `19`.
```js
assert(
assert.strictEqual(
findLongestWordLength(
'What if we try a super-long word such as otorhinolaryngology'
) === 19
),
19
);
```
@@ -73,7 +74,7 @@ function findLongestWordLength(str) {
return str.length;
}
findLongestWordLength("The quick brown fox jumped over the lazy dog");
findLongestWordLength('The quick brown fox jumped over the lazy dog');
```
# --solutions--
@@ -83,5 +84,5 @@ function findLongestWordLength(str) {
return str.split(' ').sort((a, b) => b.length - a.length)[0].length;
}
findLongestWordLength("The quick brown fox jumped over the lazy dog");
findLongestWordLength('The quick brown fox jumped over the lazy dog');
```

View File

@@ -21,73 +21,73 @@ Lastly, `["Alien", "line"]`, should return `true` because all of the letters in
`mutation(["hello", "hey"])` should return `false`.
```js
assert(mutation(['hello', 'hey']) === false);
assert.isFalse(mutation(['hello', 'hey']));
```
`mutation(["hello", "Hello"])` should return `true`.
```js
assert(mutation(['hello', 'Hello']) === true);
assert.isTrue(mutation(['hello', 'Hello']));
```
`mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])` should return `true`.
```js
assert(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu']) === true);
assert.isTrue(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu']));
```
`mutation(["Mary", "Army"])` should return `true`.
```js
assert(mutation(['Mary', 'Army']) === true);
assert.isTrue(mutation(['Mary', 'Army']));
```
`mutation(["Mary", "Aarmy"])` should return `true`.
```js
assert(mutation(['Mary', 'Aarmy']) === true);
assert.isTrue(mutation(['Mary', 'Aarmy']));
```
`mutation(["Alien", "line"])` should return `true`.
```js
assert(mutation(['Alien', 'line']) === true);
assert.isTrue(mutation(['Alien', 'line']));
```
`mutation(["floor", "for"])` should return `true`.
```js
assert(mutation(['floor', 'for']) === true);
assert.isTrue(mutation(['floor', 'for']));
```
`mutation(["hello", "neo"])` should return `false`.
```js
assert(mutation(['hello', 'neo']) === false);
assert.isFalse(mutation(['hello', 'neo']));
```
`mutation(["voodoo", "no"])` should return `false`.
```js
assert(mutation(['voodoo', 'no']) === false);
assert.isFalse(mutation(['voodoo', 'no']));
```
`mutation(["ate", "date"])` should return `false`.
```js
assert(mutation(['ate', 'date']) === false);
assert.isFalse(mutation(['ate', 'date']));
```
`mutation(["Tiger", "Zebra"])` should return `false`.
```js
assert(mutation(['Tiger', 'Zebra']) === false);
assert.isFalse(mutation(['Tiger', 'Zebra']));
```
`mutation(["Noel", "Ole"])` should return `true`.
```js
assert(mutation(['Noel', 'Ole']) === true);
assert.isTrue(mutation(['Noel', 'Ole']));
```
# --seed--
@@ -99,7 +99,7 @@ function mutation(arr) {
return arr;
}
mutation(["hello", "hey"]);
mutation(['hello', 'hey']);
```
# --solutions--
@@ -108,10 +108,16 @@ mutation(["hello", "hey"]);
function mutation(arr) {
let hash = Object.create(null);
arr[0].toLowerCase().split('').forEach(c => hash[c] = true);
arr[0]
.toLowerCase()
.split('')
.forEach(c => (hash[c] = true));
return !arr[1].toLowerCase().split('').filter(c => !hash[c]).length;
return !arr[1]
.toLowerCase()
.split('')
.filter(c => !hash[c]).length;
}
mutation(["hello", "hey"]);
mutation(['hello', 'hey']);
```

View File

@@ -8,56 +8,56 @@ dashedName: repeat-a-string-repeat-a-string
# --description--
Repeat a given string `str` (first argument) for `num` times (second argument). Return an empty string if `num` is not a positive number. For the purpose of this challenge, do *not* use the built-in `.repeat()` method.
Repeat a given string `str` (first argument) for `num` times (second argument). Return an empty string if `num` is not a positive number. For the purpose of this challenge, do _not_ use the built-in `.repeat()` method.
# --hints--
`repeatStringNumTimes("*", 3)` should return the string `***`.
```js
assert(repeatStringNumTimes('*', 3) === '***');
assert.strictEqual(repeatStringNumTimes('*', 3), '***');
```
`repeatStringNumTimes("abc", 3)` should return the string `abcabcabc`.
```js
assert(repeatStringNumTimes('abc', 3) === 'abcabcabc');
assert.strictEqual(repeatStringNumTimes('abc', 3), 'abcabcabc');
```
`repeatStringNumTimes("abc", 4)` should return the string `abcabcabcabc`.
```js
assert(repeatStringNumTimes('abc', 4) === 'abcabcabcabc');
assert.strictEqual(repeatStringNumTimes('abc', 4), 'abcabcabcabc');
```
`repeatStringNumTimes("abc", 1)` should return the string `abc`.
```js
assert(repeatStringNumTimes('abc', 1) === 'abc');
assert.strictEqual(repeatStringNumTimes('abc', 1), 'abc');
```
`repeatStringNumTimes("*", 8)` should return the string `********`.
```js
assert(repeatStringNumTimes('*', 8) === '********');
assert.strictEqual(repeatStringNumTimes('*', 8), '********');
```
`repeatStringNumTimes("abc", -2)` should return an empty string (`""`).
```js
assert(repeatStringNumTimes('abc', -2) === '');
assert.isEmpty(repeatStringNumTimes('abc', -2));
```
The built-in `repeat()` method should not be used.
```js
assert(!/\.repeat/g.test(__helpers.removeJSComments(code)));
assert.notMatch(__helpers.removeJSComments(code), /\.repeat/g);
```
`repeatStringNumTimes("abc", 0)` should return `""`.
```js
assert(repeatStringNumTimes('abc', 0) === '');
assert.isEmpty(repeatStringNumTimes('abc', 0));
```
# --seed--
@@ -69,7 +69,7 @@ function repeatStringNumTimes(str, num) {
return str;
}
repeatStringNumTimes("abc", 3);
repeatStringNumTimes('abc', 3);
```
# --solutions--
@@ -77,8 +77,8 @@ repeatStringNumTimes("abc", 3);
```js
function repeatStringNumTimes(str, num) {
if (num < 1) return '';
return num === 1 ? str : str + repeatStringNumTimes(str, num-1);
return num === 1 ? str : str + repeatStringNumTimes(str, num - 1);
}
repeatStringNumTimes("abc", 3);
repeatStringNumTimes('abc', 3);
```

View File

@@ -17,13 +17,13 @@ Remember, you can iterate through an array with a simple for loop, and access ea
`largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])` should return an array.
```js
assert(
assert.isArray(
largestOfFour([
[4, 5, 1, 3],
[13, 27, 18, 26],
[32, 35, 37, 39],
[1000, 1001, 857, 1]
]).constructor === Array
])
);
```
@@ -78,7 +78,12 @@ function largestOfFour(arr) {
return arr;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
largestOfFour([
[4, 5, 1, 3],
[13, 27, 18, 26],
[32, 35, 37, 39],
[1000, 1001, 857, 1]
]);
```
# --solutions--
@@ -88,5 +93,10 @@ function largestOfFour(arr) {
return arr.map(subArr => Math.max.apply(null, subArr));
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
largestOfFour([
[4, 5, 1, 3],
[13, 27, 18, 26],
[32, 35, 37, 39],
[1000, 1001, 857, 1]
]);
```

View File

@@ -17,25 +17,28 @@ For example, `"hello"` should become `"olleh"`.
`reverseString("hello")` should return a string.
```js
assert(typeof reverseString('hello') === 'string');
assert.isString(reverseString('hello'));
```
`reverseString("hello")` should return the string `olleh`.
```js
assert(reverseString('hello') === 'olleh');
assert.strictEqual(reverseString('hello'), 'olleh');
```
`reverseString("Howdy")` should return the string `ydwoH`.
```js
assert(reverseString('Howdy') === 'ydwoH');
assert.strictEqual(reverseString('Howdy'), 'ydwoH');
```
`reverseString("Greetings from Earth")` should return the string `htraE morf sgniteerG`.
```js
assert(reverseString('Greetings from Earth') === 'htraE morf sgniteerG');
assert.strictEqual(
reverseString('Greetings from Earth'),
'htraE morf sgniteerG'
);
```
# --seed--
@@ -47,7 +50,7 @@ function reverseString(str) {
return str;
}
reverseString("hello");
reverseString('hello');
```
# --solutions--
@@ -57,5 +60,5 @@ function reverseString(str) {
return str.split('').reverse().join('');
}
reverseString("hello");
reverseString('hello');
```

View File

@@ -69,7 +69,7 @@ assert.deepEqual(testArr2, ['a', 'b']);
```js
let testArr1 = [1, 2];
let testArr2 = ["a", "b"];
let testArr2 = ['a', 'b'];
```
## --seed-contents--
@@ -89,7 +89,7 @@ function frankenSplice(arr1, arr2, n) {
// It's alive. It's alive!
let result = arr2.slice();
for (let i = 0; i < arr1.length; i++) {
result.splice(n+i, 0, arr1[i]);
result.splice(n + i, 0, arr1[i]);
}
return result;
}

View File

@@ -17,27 +17,27 @@ For the purpose of this exercise, you should also capitalize connecting words li
`titleCase("I'm a little tea pot")` should return a string.
```js
assert(typeof titleCase("I'm a little tea pot") === 'string');
assert.isString(titleCase("I'm a little tea pot"));
```
`titleCase("I'm a little tea pot")` should return the string `I'm A Little Tea Pot`.
```js
assert(titleCase("I'm a little tea pot") === "I'm A Little Tea Pot");
assert.strictEqual(titleCase("I'm a little tea pot"), "I'm A Little Tea Pot");
```
`titleCase("sHoRt AnD sToUt")` should return the string `Short And Stout`.
```js
assert(titleCase('sHoRt AnD sToUt') === 'Short And Stout');
assert.strictEqual(titleCase('sHoRt AnD sToUt'), 'Short And Stout');
```
`titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")` should return the string `Here Is My Handle Here Is My Spout`.
```js
assert(
titleCase('HERE IS MY HANDLE HERE IS MY SPOUT') ===
'Here Is My Handle Here Is My Spout'
assert.strictEqual(
titleCase('HERE IS MY HANDLE HERE IS MY SPOUT'),
'Here Is My Handle Here Is My Spout'
);
```
@@ -57,7 +57,10 @@ titleCase("I'm a little tea pot");
```js
function titleCase(str) {
return str.split(' ').map(word => word.charAt(0).toUpperCase() + word.substring(1).toLowerCase()).join(' ');
return str
.split(' ')
.map(word => word.charAt(0).toUpperCase() + word.substring(1).toLowerCase())
.join(' ');
}
titleCase("I'm a little tea pot");

View File

@@ -15,53 +15,55 @@ Truncate a string (first argument) if it is longer than the given maximum string
`truncateString("A-tisket a-tasket A green and yellow basket", 8)` should return the string `A-tisket...`.
```js
assert(
truncateString('A-tisket a-tasket A green and yellow basket', 8) ===
'A-tisket...'
assert.strictEqual(
truncateString('A-tisket a-tasket A green and yellow basket', 8),
'A-tisket...'
);
```
`truncateString("Peter Piper picked a peck of pickled peppers", 11)` should return the string `Peter Piper...`.
```js
assert(
truncateString('Peter Piper picked a peck of pickled peppers', 11) ===
'Peter Piper...'
assert.strictEqual(
truncateString('Peter Piper picked a peck of pickled peppers', 11),
'Peter Piper...'
);
```
`truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)` should return the string `A-tisket a-tasket A green and yellow basket`.
```js
assert(
assert.strictEqual(
truncateString(
'A-tisket a-tasket A green and yellow basket',
'A-tisket a-tasket A green and yellow basket'.length
) === 'A-tisket a-tasket A green and yellow basket'
),
'A-tisket a-tasket A green and yellow basket'
);
```
`truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)` should return the string `A-tisket a-tasket A green and yellow basket`.
```js
assert(
assert.strictEqual(
truncateString(
'A-tisket a-tasket A green and yellow basket',
'A-tisket a-tasket A green and yellow basket'.length + 2
) === 'A-tisket a-tasket A green and yellow basket'
),
'A-tisket a-tasket A green and yellow basket'
);
```
`truncateString("A-", 1)` should return the string `A...`.
```js
assert(truncateString('A-', 1) === 'A...');
assert.strictEqual(truncateString('A-', 1), 'A...');
```
`truncateString("Absolutely Longer", 2)` should return the string `Ab...`.
```js
assert(truncateString('Absolutely Longer', 2) === 'Ab...');
assert.strictEqual(truncateString('Absolutely Longer', 2), 'Ab...');
```
# --seed--
@@ -73,7 +75,7 @@ function truncateString(str, num) {
return str;
}
truncateString("A-tisket a-tasket A green and yellow basket", 8);
truncateString('A-tisket a-tasket A green and yellow basket', 8);
```
# --solutions--
@@ -87,5 +89,5 @@ function truncateString(str, num) {
return str.slice(0, num) + '...';
}
truncateString("A-tisket a-tasket A green and yellow basket", 8);
truncateString('A-tisket a-tasket A green and yellow basket', 8);
```

View File

@@ -16,100 +16,100 @@ Likewise, `getIndexToIns([20,3,5], 19)` should return `2` because once the array
# --hints--
`getIndexToIns([10, 20, 30, 40, 50], 35)` should return `3`.
```js
assert(getIndexToIns([10, 20, 30, 40, 50], 35) === 3);
```
`getIndexToIns([10, 20, 30, 40, 50], 35)` should return a number.
```js
assert(typeof getIndexToIns([10, 20, 30, 40, 50], 35) === 'number');
assert.isNumber(getIndexToIns([10, 20, 30, 40, 50], 35));
```
`getIndexToIns([10, 20, 30, 40, 50], 30)` should return `2`.
`getIndexToIns([10, 20, 30, 40, 50], 35)` should return `3`.
```js
assert(getIndexToIns([10, 20, 30, 40, 50], 30) === 2);
assert.strictEqual(getIndexToIns([10, 20, 30, 40, 50], 35), 3);
```
`getIndexToIns([10, 20, 30, 40, 50], 30)` should return a number.
```js
assert(typeof getIndexToIns([10, 20, 30, 40, 50], 30) === 'number');
assert.isNumber(getIndexToIns([10, 20, 30, 40, 50], 30));
```
`getIndexToIns([40, 60], 50)` should return `1`.
`getIndexToIns([10, 20, 30, 40, 50], 30)` should return `2`.
```js
assert(getIndexToIns([40, 60], 50) === 1);
assert.strictEqual(getIndexToIns([10, 20, 30, 40, 50], 30), 2);
```
`getIndexToIns([40, 60], 50)` should return a number.
```js
assert(typeof getIndexToIns([40, 60], 50) === 'number');
assert.isNumber(getIndexToIns([40, 60], 50));
```
`getIndexToIns([3, 10, 5], 3)` should return `0`.
`getIndexToIns([40, 60], 50)` should return `1`.
```js
assert(getIndexToIns([3, 10, 5], 3) === 0);
assert.strictEqual(getIndexToIns([40, 60], 50), 1);
```
`getIndexToIns([3, 10, 5], 3)` should return a number.
```js
assert(typeof getIndexToIns([3, 10, 5], 3) === 'number');
assert.isNumber(getIndexToIns([3, 10, 5], 3));
```
`getIndexToIns([5, 3, 20, 3], 5)` should return `2`.
`getIndexToIns([3, 10, 5], 3)` should return `0`.
```js
assert(getIndexToIns([5, 3, 20, 3], 5) === 2);
assert.strictEqual(getIndexToIns([3, 10, 5], 3), 0);
```
`getIndexToIns([5, 3, 20, 3], 5)` should return a number.
```js
assert(typeof getIndexToIns([5, 3, 20, 3], 5) === 'number');
assert.isNumber(getIndexToIns([5, 3, 20, 3], 5));
```
`getIndexToIns([5, 3, 20, 3], 5)` should return `2`.
```js
assert.strictEqual(getIndexToIns([5, 3, 20, 3], 5), 2);
```
`getIndexToIns([2, 20, 10], 19)` should return `2`.
```js
assert(getIndexToIns([2, 20, 10], 19) === 2);
assert.strictEqual(getIndexToIns([2, 20, 10], 19), 2);
```
`getIndexToIns([2, 20, 10], 19)` should return a number.
```js
assert(typeof getIndexToIns([2, 20, 10], 19) === 'number');
assert.isNumber(getIndexToIns([2, 20, 10], 19));
```
`getIndexToIns([2, 5, 10], 15)` should return `3`.
```js
assert(getIndexToIns([2, 5, 10], 15) === 3);
assert.strictEqual(getIndexToIns([2, 5, 10], 15), 3);
```
`getIndexToIns([2, 5, 10], 15)` should return a number.
```js
assert(typeof getIndexToIns([2, 5, 10], 15) === 'number');
```
`getIndexToIns([], 1)` should return `0`.
```js
assert(getIndexToIns([], 1) === 0);
assert.isNumber(getIndexToIns([2, 5, 10], 15));
```
`getIndexToIns([], 1)` should return a number.
```js
assert(typeof getIndexToIns([], 1) === 'number');
assert.isNumber(getIndexToIns([], 1));
```
`getIndexToIns([], 1)` should return `0`.
```js
assert.strictEqual(getIndexToIns([], 1), 0);
```
# --seed--