London | 26-ITP-May | Damilola Odumosu | Sprint 1 | Coursework#1364
London | 26-ITP-May | Damilola Odumosu | Sprint 1 | Coursework#1364d-odumosu wants to merge 18 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.
There was a problem hiding this comment.
i'll change them to twelveHourClockTime, TwentyfourHourClockTime.
| // 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 ")".
There was a problem hiding this comment.
A comma is missing between the arguments
|
|
||
| //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?
There was a problem hiding this comment.
I have gone with movieRuntime, other variables could be movieLength, movieDuration
|
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 _12HourClockTime = "8:53pm"; | ||
| const $24hourClockTime = "20:53"; | ||
|
|
||
| //when starting a variable name with a number we have to precede with either of _ or $ No newline at end of file | ||
| //when starting a variable name with a number we have to precede with either of _ or $ | ||
| // No newline at end of file |
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.
There was a problem hiding this comment.
twentyFouHourClockTime and twelveHourClockTime
| // Create a variable to store the ext part of the variable | ||
| const firstSlash = filePath.indexOf("/"); | ||
| const firstSlashIndex = filePath.indexOf("/"); | ||
| const period = filePath.indexOf("."); |
There was a problem hiding this comment.
A folder name may contain a '.'. A more robust approach would be to search for the last (instead othe first) instance of '.' in the path.
There was a problem hiding this comment.
Thank you, i have implemented this
| const seventhSlash = filePath.indexOf("/", sixthSlash + 1); | ||
| const eighthSlash = filePath.indexOf("/", seventhSlash + 1); | ||
|
|
||
| const dirPath = filePath.slice(firstSlashIndex,lastSlashIndex + 1) |
There was a problem hiding this comment.
According to the diagram, the value of dir does not include a trailing '/'.
|
|
||
| // e) What do you think the variable result represents? Can you think of a better name for this variable? | ||
| //runTime | ||
| //movieRunTime |
There was a problem hiding this comment.
Could also add a prefix formatted or a suffix Str to hint the variable stores a string.
|
Thank you so much for your time reviewing my pr. |
Learners, PR Template
Self checklist
Changelist
I have completed the coursework requirements