Funkcję możemy podzielić na tę zwracające wartość i te blokujące kod.
Przykład użycia funkcji zwracającej:
// Function is called, the return value will end up in x let x = myFunction(4, 3); function myFunction(a, b) { // Function returns the product of a and b return a * b; }
Przykład użycia funkcji blokującej
function printText() { ... } printText();