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

Tao Zhang
3,181 PointsIs assigning a variable to a function a form of calling a function?
The IsFieldEmpty function is not called explicitly or assigning fieldTest to this function part of the process?
" function isFieldEmpty () { const field = document.querySelector ('#info'); if (field.value === '') { return true; } else { return false; } }
const fieldTest = isFieldEmpty();
if (fieldTest === true) { alert('You need to provide info'); }"
1 Answer

Steven Parker
234,543 PointsThis isn't "assigning a variable to a function", it is assigning a variable with the value returned from a function.
But yes, the function gets called to get the value to assign to the variable.
Tao Zhang
3,181 PointsTao Zhang
3,181 PointsThanks for the clarification. are there any other ways to call a function besides using "function ();" and assigning a variable to a function?
Steven Parker
234,543 PointsSteven Parker
234,543 PointsYou'll always use the function name followed by parentheses when calling a function. But there are many was to use one besides assigning a variable with it. For examples: