课程: Hands-On Introduction: JavaScript

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Add a button to change units

Add a button to change units

- [Instructor] Internationalization is an important yet oft overlooked feature of front end web development. Basically, the web is global and people can access any web application from anywhere in the world. And different people in different regions use different units to measure things like temperature. So therefore, the user needs to be able to switch the temperature and wind speed display to fit with the units of their preference. That's what we're going to do in this movie. I've already added a button here for us to change units, but it's currently not doing anything. That's because we need to wire a bunch of pieces together and set up a function to make all of this work. So let's get started. The first thing is we need to set up a default unit. If you go to settings.js, you'll remember we have the app ID, we have the location, and we also have this units measure. And the units entry is the default. I've set it…

内容