课程: JavaScript: Best Practices for Data

今天就学习课程吧!

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

Solution: Compare values

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…

内容