Killersites Forums

# Search the Community

Showing results for tags 'checkio'.

• ### Search By Tags

Type tags separated by commas.

### Forums

• Job Boards
• Jobs
• Community Lounge and FAQ
• Forum News
• Open Forum
• New Members Forum - Start Here!
• Entrepreneurship, Business and Marketing
• Social Media Marketing & Web Marketing
• Entrepreneurship
• Career Questions - Asked and Answered
• StudioWeb
• StudioWeb
• StudioWeb News
• StudioWeb Projects
• Programming
• Python
• Javascript
• PHP
• Web Design
• Beginners Web Design
• HTML/XHTML
• Dreamweaver
• CSS
• Advanced Web Design
• Business of Web Design
• Web Design News
• Miscellaneous
• Cybersecurity
• Miscellaneous Software
• Blogs and CMS
• Web Accessibility
• Peer-to-Peer Reviews
• Website Templates
• Web Design Jobs
• Test Forum
• Archives
• Beginners Web Design
• Course: The Complete Entrepreneur
• Web Accessibility
• Photoshop
• CSS
• Forum Rules and Etiquette
• Flash
• ASP
• General Programming
• Expression Web
• Beginners Ruby
• Killersites University
• Actionscript

### Calendars

• Community Calendar

### Product Groups

• Business & Entrepreneur Courses

• 0 Replies

• 0 Reviews

• 0 Views

Found 1 result

1. ## I need help with a JavaScript challenge on Checkio

Hey everybody, I'm a beginner at JavaScript so there are many things I don't understand. I'd appreciate very much if you can help me figuring out something new. I'm trying to solve this problem on Checkio.org called "The Most Numbers". The requirement is quite simple: It is given an array of floats and you have to calculate the difference between the maximum and minimum numbers. And this is my solution (which didn't work): function mostNumbers(numbers){ if (numbers.length > 0) { return Math.max(numbers) - Math.min(numbers); } else { return 0;} } It produced "0" regardless of what "numbers" is. I tried some stuff related to the Math.max() and Math.min() methods. And this is what I received: Math.max(1,2,3) // => 3 But when I assigned the array to a variable, this is what I received: var numbers = (1,2,3); Math.max(numbers) // => 3 (nothing wrong) Math.min(numbers) // => 3 (why?) I realized that it always take the last number, regardless what I want, so I tried typing (1,2,3) into the console and I got 3. Why is that? Then I realized that this is not a normal array, which has the structure [something, something else,...]. I reached out to w3school but what I received are just simple examples like Math.max(5, 10); // => 10 I reached out to stackoverflows as well and found this: With all the respect for this person (who is contributing value, that's great), I find the problem even more confusing. - What is a series of numbers, if not an array of numbers? - What is a spread operator? I clicked on the link he/she provided, but I didn't understand what I read: Thank you for reading my post, I know it's long. I appreciate it.
×