Functions act as placeholders for the data they output. Basically, you can assign the output of a function to a variable, just like any normal data.Call the processArg function with an argument of 7 and assign its return value to the variable processed. Actually you are assigning the complete promise to the variable text. Replace var text = getText(item.name).then(res=>console.log(res)). One of the things I wanted to change was to turn the assignment operator into an assignment command, removing the ability to make use of the returned value. We can take the return value of a function and assign it to a variable. Assume we have pre-defined a function sum which adds two numbers together. The assignment ( = ) operator is used to assign a value to a variable or property. The assignment expression itself has a value, which is the assigned value.