Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.
Open
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
5 changes: 5 additions & 0 deletions week-1/exercises/initials.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
let firstName = "Creola";
let middleName = "Katherine";
let lastName = "Johnson";
let initials ="";
initials+=(firstName[0]);
initials+=(middleName[0]);
initials+=(lastName[0]);
console.log(initials);

// Declare a variable called initials that stores the first character of each string in upper case to form the user's initials
// Log the variable in each case
5 changes: 5 additions & 0 deletions week-1/exercises/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@

const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt";
const lastSlashIndex = filePath.lastIndexOf("/");
const lastPeriodIndex = filePath.lastIndexOf(".")
const base = filePath.slice(lastSlashIndex + 1);
const dir = filePath.slice(0,lastSlashIndex + 1);
const ext = filePath.slice(lastPeriodIndex);
console.log(`The base part of ${filePath} is ${base}`);
console.log(`The dir part of ${filePath} is ${dir}`);
console.log(`The ext part of ${filePath} is ${ext}`);

// Create a variable to store the dir part of the filePath variable
// Create a variable to store the ext part of the variable