Queequeg
Queequeg
KPCKevin Powell - Community
Created by RMON on 1/23/2024 in #front-end
Need Advice Regarding JavaScript
Taking notes isn't bad - it is just not the best way to learn to code (arguably to learn any skill). If you find notes do help you, after the lecture/video/session, summarize what you have learned from memory in your notes. This will help the info stick and provide an easy place to look for future reference if you ever end up referencing your notes.
19 replies
KPCKevin Powell - Community
Created by Nikita on 7/6/2023 in #front-end
Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
I learn something new every day! Thanks. While reading the documentation, I also learned that combining || and ?? in a series of checks will not work without parenthesis. This is something to keep in mind as I frequently do this too.
16 replies
KPCKevin Powell - Community
Created by Nikita on 7/6/2023 in #front-end
Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
I have not used ?? in code before, I have used || a ton.
16 replies
KPCKevin Powell - Community
Created by Nikita on 7/6/2023 in #front-end
Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
@jochemm I was going to suggest using a logical OR like so:
const onTimeUpdate = () => {
setCurrentTime(() => convertToMinuteSeconds(videoRef.current?.currentTime || 0))
}
const onTimeUpdate = () => {
setCurrentTime(() => convertToMinuteSeconds(videoRef.current?.currentTime || 0))
}
Do you think the ?? operator better or about the same as || in situations like these? Given, of course, that a 0 will fall through to default as 0 in this case.
16 replies
KPCKevin Powell - Community
Created by ZeR0ByTe on 6/20/2023 in #front-end
Angular: How to use local json with my content/assets?
I don't know the answer to your question, but I'd make sure that your asset folder being included in the compiled output? Does this SO help: https://stackoverflow.com/a/64589400
2 replies
KPCKevin Powell - Community
Created by Sste on 4/20/2023 in #front-end
Timer is BUGGED
You are definitely getting stronger with JavaScript.
21 replies
KPCKevin Powell - Community
Created by Sste on 4/20/2023 in #front-end
Timer is BUGGED
I also reset the startButton label on reset. 🙂
21 replies
KPCKevin Powell - Community
Created by Sste on 4/20/2023 in #front-end
Timer is BUGGED
If you clear the interval before each start, you have to make sure you keep the currentTime up to date and only use startTime when resetting the currentTIme.
21 replies
KPCKevin Powell - Community
Created by Sste on 4/20/2023 in #front-end
Timer is BUGGED
I updated your code here: https://codepen.io/nephiw/pen/qBJqzYg
21 replies
KPCKevin Powell - Community
Created by Sste on 4/20/2023 in #front-end
Timer is BUGGED
Try clearing the interval before you create a new one. This will ensure that you only have one.
21 replies
KPCKevin Powell - Community
Created by Sste on 4/20/2023 in #front-end
Timer is BUGGED
I think you are creating multiple intervals; each time you start your timer, you create a new interval, but don't clear the currently running one. This means the more you start/pause, the more confused the count down will appear.
21 replies