Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

brendon hanson
brendon hanson
6,191 Points

Basic JS(Functions) Help

I just completed the basic JS course! I understand everything pretty well, except for functions! I just don't understand why we need them....or how they work! It's so frustrating and I think if a just practice them for a couple of weeks then maybe a could get the hang of it but I don't know how to practice them. If anyone could give me ways to practice/understand them or even help me understand them better I would appreciate that a lot! I'm 14 btw

1 Answer

Andrei Duhanes
Andrei Duhanes
14,155 Points

In every programming language, JavaScript included, you have data types ( like primitives, arrays, objects ) and actions ( to make those data types do stuff, interract in some way). And each time you use a method like ( console.log() for example or prompt()), you are actually using a function inbuilt by the javascript engine. So think of it in this way: Each time you actually want your program to do something with the data you have, you will be using functions or methods (which are functions of objects). So functions are all around..