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: Compare values

Challenge: Compare values - JavaScript Tutorial

From the course: JavaScript: Best Practices for Data

Start my 1-month free trial

Challenge: Compare values

(upbeat bouncy music) - [Narrator] Ready to try your hand at writing better comparisons? It's time for a challenge. I've written some code that simulates a shopping cart and performs a few actions based on values in the cart object. Your task is to update the code to make it easier to read and to follow best practices for comparisons. Add rules as appropriate to .ESLint RC, to check for issues, as well as fixing those issues in the app.js file. Note that the code I've written is intentionally convoluted here and there. So if you're not sure what a statement is doing, take a moment, step back, and break it down. This exercise should take you about 15 minutes. When you're done, join me in the next video, and I'll walk you through how I approached it.

Contents