From the course: JavaScript: Best Practices for Functions and Classes

Unlock the full course today

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

Challenge: Create classes

Challenge: Create classes - JavaScript Tutorial

From the course: JavaScript: Best Practices for Functions and Classes

Start my 1-month free trial

Challenge: Create classes

(upbeat music) - [Instructor] Ready to put best practices to work in creating classes? It's time for a challenge. My start code includes a class that creates a mailing label, including properties for the full name, street and city state zip for a US mailing address, abbreviated CSZ. It also has a log label method to log the values to the console in the layout you'd expect in a printed mailing label. This code works, but there are a few issues with the class, including its use of the this keyword. Update the code in the app.js file to implement the best practices for classes in context. You should also add rules as appropriate to eslintrc to check for issues. This exercise should take you about 10 minutes. When you're done, join me in the next video and I'll walk you through how I approached it.

Contents