Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions prep/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const yearOfBirth = 1990; // declaration
let currentYear = 2023; // declaration

currentYear++; // statement
`I am ${currentYear - yearOfBirth} years old`; // statement

console.log(`I am ${currentYear - yearOfBirth} years old`); // statement
console.log("hello there")
18 changes: 18 additions & 0 deletions prep/example1.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Explanation: This file contains a function `getLargest` that takes three numbers as input and returns the largest of the three. The function uses conditional statements to compare the numbers and determine which one is the largest. The test case at the bottom checks if the function correctly identifies the largest number in various scenarios, including when all numbers are the same.

function getLargest(a, b, c) {
if (a >= b && a >= c) {
return a;
}
if (b >= a && b >= c) {
return b;
}
return c;
}

test("returns the largest of three numbers", () => {
expect(getLargest(1, 2, 3)).toEqual(3);
expect(getLargest(10, 5, 7)).toEqual(10);
expect(getLargest(4, 9, 6)).toEqual(9);
expect(getLargest(5, 5, 5)).toEqual(5);
});
Loading
Loading