From the course: JavaScript for Web Designers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Polish the clock - JavaScript Tutorial
From the course: JavaScript for Web Designers
Polish the clock
- Let's finish tidying up this clock. I want to get rid of this little bit of side to side motion. Because we're using a 12-hour time display, I'd like to display the meridiem, that is whether it's AM or PM, and deal with any edge cases we can think of, like what happens during the midnight hour. We'll deal with jumpiness first. Right now, I'm either displaying a colon or a space, and they're not the same width, so it kind of shifts things around a little bit. Instead, I think I'd like to always display this colon but just make it transparent or white. Let's go back to our code and take care of that first. Here in Visual Studio Code, I have my separator right here. What we're going to do is we're going to wrap that in a class. So I'm going to create a variable for that class first which will initially be set to nothing. This project includes a class called trans, short for transparent. And so now, instead of making the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.