From the course: JavaScript: Best Practices for Data

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Type cast

Challenge: Type cast - JavaScript Tutorial

From the course: JavaScript: Best Practices for Data

Start my 1-month free trial

Challenge: Type cast

(upbeat music) - [Instructor] Ready to type cast some values using best practices? It's time for a challenge. My code starts with some string data from a weather service, converts a Celsius temperature to Fahrenheit, and then takes a first step in putting that data in the view by console.logging it. Your task is to type cast data when necessary and then update existing type casting as necessary to use best practices. I've highlighted here on lines 11 and 16 where type casting needs to happen in the statements that follow those comments. You'll have to decide on the best approach to doing that. In addition, the code works with Booleans a few times, and you should make sure that best practices are being implemented in all of these statements. Add rules as appropriate to dot ESLint RC to check for issues, as well as fixing those issues in the app.js file. This exercise should take you about 10 minutes. When you're done…

Contents