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
Daniyell Augusta
Courses Plus Student 495 PointsWhat is the difference between a command and a function (looking at the prompt command)?
Prompt is described as a command and does not use a semicolon. However, it is explained with alert, which is a function. Why is prompt not a function?
2 Answers
Steven Parker
243,318 Points"prompt" is a function, where did you see something that implied otherwise? And in JavaScript, semicolons are optional at the end of a line, but it is considered "good practice" to use them anyway. This applies to any statement, it's not unique to "prompt" function.
The word "command" is typically used to describe terms entered into the console and is unrelated to nature of the term itself as used in a program.
Daniyell Augusta
Courses Plus Student 495 PointsIn the "capturing visitor input" video, I think Dave didn't mention the word function (I could be wrong though). This may seem a little picky now, but since we are talking programming, you know.
Thanks for the explanation concerning semicolon and command.