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.

Solution: Compare values

Solution: Compare values - JavaScript Tutorial

From the course: JavaScript: Best Practices for Data

Start my 1-month free trial

Solution: Compare values

(upbeat music) - [Instructor] So, at the top of my code, I have a cart object, and then I have all of this logical code with all of these comparisons starting on line 11. And looking at this line by line, basically this section is checking the number of items in the cart using some other factors to calculate the shipping, or whether shipping needs to be determined later, and then down here there's this contact property we're setting a value for, and that I just thought of as if there's some complications going on with this order, then we'll flag it to have someone actually reach out, contact the customer, and resolve some issues, or iron some logistics out. So, I'm going to start with the flow control up here. Save that nice, gnarly ternary for a little bit later, and this is one of those places where I think putting the ESLint rules in place first can be really helpful, 'cause they can point out some of those errors…

Contents