Skip to content

Commit eb034f3

Browse files
author
Enice-Codes
committed
remove dead-code and stretch files, not part of this task
1 parent 97ed99a commit eb034f3

5 files changed

Lines changed: 7 additions & 74 deletions

File tree

Sprint-3/3-dead-code/exercise-1.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ let testName = "Jerry";
55
const greeting = "hello";
66

77
function sayHello(greeting, name) {
8+
const greetingStr = greeting + ", " + name + "!";
89
return `${greeting}, ${name}!`;
9-
10+
console.log(greetingStr);
1011
}
1112

1213
testName = "Aman";

Sprint-3/3-dead-code/exercise-2.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
// The countAndCapitalisePets function should continue to work for any reasonable input it's given, and you shouldn't modify the pets variable.
33

44
const pets = ["parrot", "hamster", "horse", "dog", "hamster", "cat", "hamster"];
5-
5+
const capitalisedPets = pets.map((pet) => pet.toUpperCase());
66
const petsStartingWithH = pets.filter((pet) => pet[0] === "h");
77

8-
8+
function logPets(petsArr) {
9+
petsArr.forEach((pet) => console.log(pet));
10+
}
911

1012
function countAndCapitalisePets(petsArr) {
1113
const petCount = {};

Sprint-3/4-stretch/find.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,6 @@ console.log(find("code your future", "z"));
2020
// Pay particular attention to the following:
2121

2222
// a) How the index variable updates during the call to find
23-
// the index variable starts at 0 and is incremented by 1 after each iteration of the while loop.
24-
2523
// b) What is the if statement used to check
26-
// the if statement is used to check if the character at the current index of the string is equal to the character we are searching for.
27-
// if the condition is true ,it will return the index of the character in the string. '
28-
// if the condition is false, it will continue to the next iteration of the loop until it finds the character or reaches the end of the string.
29-
3024
// c) Why is index++ being used?
31-
/*
32-
the index++ is used to increment the index variable by 1 after each iteration of the loop.
33-
This allows the loop to move to the next character in the string for the next iteration. Without this increment,
34-
the loop would get stuck on the same character and could potentially run indefinitely if the condition is never met.
35-
*/
36-
3725
// d) What is the condition index < str.length used for?
38-
/*
39-
the index < str.length condition is used to ensure that the loop continues to iterate through the string until it reaches the end.
40-
the index variable is used to keep track of the current position in the string, and the loop will continue as long as index is less than the length of the string.
41-
Once index reaches the length of the string,
42-
it means we have checked all characters in the string, and if we haven't found the character we're looking for, we return -1 to indicate that it was not found.
43-
*/

Sprint-3/4-stretch/password-validator.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,4 @@ function passwordValidator(password) {
33
}
44

55

6-
module.exports = passwordValidator;
7-
function passwordValidator(password) {
8-
if (password.length < 5){
9-
return false;
10-
} else if (password.length >= 5 ){
11-
return true;
12-
}
13-
}
14-
156
module.exports = passwordValidator;

Sprint-3/4-stretch/password-validator.test.js

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -23,47 +23,4 @@ test("password has at least 5 characters", () => {
2323
// Assert
2424
expect(result).toEqual(true);
2525
}
26-
);
27-
// instruction 2
28-
const isValidPassword = require("./password-validator");
29-
test("password has least one uppercase letter", () => {
30-
// arrange
31-
const uppercase = "A -Z";
32-
// act
33-
const result = isValidPassword(uppercase);
34-
// assert
35-
expect(result).toEqual(true);
36-
});
37-
38-
// instruction 3
39-
const isValidPassword = require("./password-validator");
40-
test("password has least one lowercase letter", () => {
41-
// arrange
42-
const lowercase = "a-z";
43-
// act
44-
const result = isValidPassword(lowercase);
45-
// assert
46-
expect(result).toEqual(true);
47-
});
48-
49-
// instruction 4
50-
const isValidPassword = require("./password-validator");
51-
test("password has least one number", () => {
52-
// arrange
53-
const number = "0-9";
54-
// act
55-
const result = isValidPassword(number);
56-
// assert
57-
expect(result).toEqual(true);
58-
});
59-
60-
// instruction 5
61-
const isValidPassword = require("./password-validator");
62-
test("password has least one non-alphanumeric symbol", () => {
63-
// arrange
64-
const symbol = "!#$%.*&";
65-
// act
66-
const result = isValidPassword(symbol);
67-
// assert
68-
expect(result).toEqual(true);
69-
});
26+
);

0 commit comments

Comments
 (0)