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 Introducing JavaScript Let's Make a Game What have you learned about programming?

sohee kim
sohee kim
234 Points

How can you tell the difference about these 2 sentences?

They say "createItem(375, 300, 'coin')"

-> It 'calls' the function

-> It creates a function

is a first one not the second one.

What is difference?

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

sohee kim

As I've suggested in your other post. I strongly recommend you complete the Digital Literacy course before proceeding any further with this JavaScript course. Even being a "Beginner" level course, it still kind of does assume a very basic understanding of common syntax with languages.

You will find it a great benefit to you and to your learning, as it will help immensely with the basic understandings with syntax of the languages (including JavaScript).

:dizzy:

I would say that the function name createItem can confuse you in selecting the correct answer.

to "call" a function is to use the function in your program.

createItem(375, 300, 'coin'); is a call to the function.

to "create" a function is not a technical term, I think. One may get fooled to pick this answer because the function has the word create in it, but it isn't standard programming vocabulary. Instead you can "define" a function, which means to program/code the function initially at the beginning of your javascript document to tell it what you want the function to do when you want to use it in your code.

function createItem(xPosition, yPosition, type) { //type code here } ...is defining the function.

Note that you must define a function in order to call a function, unless you are using standard functions already defined in standard javascript libraries (like prompt(string), document.write(string), etc...).

Note that when you call a function, you use specific values or variables that you have defined in the code, like the 375, and the 300.