London | 26-ITP-May | Damilola Odumosu | Sprint 1 | Coursework#1364
London | 26-ITP-May | Damilola Odumosu | Sprint 1 | Coursework#1364d-odumosu wants to merge 13 commits into
Conversation
| const dir = filePath.slice(1 , 44); | ||
| console.log(dir) | ||
| const ext = filePath.slice(lastSlashIndex + 5 ); | ||
| console.log(ext) |
There was a problem hiding this comment.
Could you explore an approach that could work for any valid file path? For examples,
/tmp/interpret/file.json and /Users/mitch/cyf/Module-JS1/mycode.js.
There was a problem hiding this comment.
i have implemented this using indexof and slice
| const _12HourClockTime = "8:53pm"; | ||
| const $24hourClockTime = "20:53"; |
There was a problem hiding this comment.
Identifiers that begin with _ or $ are valid variable, function, class, and property names. However, they are usually used by convention to signal special meaning.
Could you explore names that start with alphabets instead? Feel free to ask AI for suggestion.
| // line 12 console,log() | ||
|
|
||
| // b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? | ||
| //A syntaxError is occurring on line 5, we are missing a "," and a closing ")" |
There was a problem hiding this comment.
We can more precisely describe "A comma is missing between "," and "" in the function call" as:
A comma is missing between the ___________s.
What is the programming term that belongs in the blank?
Note: The original code does not have a missing closing ")".
|
|
||
| //runTime |
There was a problem hiding this comment.
runTime reads like "runtime", which has a different meaning in IT. Could you suggest a different (and more descriptive) name?
|
Regarding your PR description, could you update the checkboxes to make them look like
instead of like
Relevant resource: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-tasklists |
| const firstSlash = filePath.indexOf("/"); | ||
| const period = filePath.indexOf("."); | ||
| const secondSlash = filePath.indexOf("/", firstSlash + 1); | ||
| const thirdSlash = filePath.indexOf("/", secondSlash + 1); | ||
| const fourthSlash = filePath.indexOf("/", thirdSlash + 1); | ||
| const fifthSlash = filePath.indexOf("/", fourthSlash + 1); | ||
| const sixthSlash = filePath.indexOf("/", fifthSlash + 1); | ||
| const seventhSlash = filePath.indexOf("/", sixthSlash + 1); | ||
| const eighthSlash = filePath.indexOf("/", seventhSlash + 1); | ||
|
|
There was a problem hiding this comment.
Could you revise your code so that it works for any valid file path? For examples,
"/Users/folder.abc/data.json"
and
"/path1/path2/path3/file.tar.gz"
Note:
- You could use the method used on line 13 to locate the last (right most) instance of a character in a string.
- A file path always begin with a
'/'.
Learners, PR Template
Self checklist
Changelist
I have completed the coursework requirements