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

Unlock the full course today

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

Challenge: Create functions

Challenge: Create functions - JavaScript Tutorial

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

Start my 1-month free trial

Challenge: Create functions

(upbeat music) - [Instructor] Ready to test and implement best practices in creating functions? It's time for a challenge. My start code includes a function that takes in array as an argument and returns a string based on the maximum value found in that array. I use a nested array .reduce method to find the maximum value in that array. My code works but the function has several issues that make it more complex and harder to read than it should be. You'll implement best practices for functions throughout the code in the app.js file. You'll also add rules as appropriate to .ESLintrc.js 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