[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Statements/function [Back]  [Original]

function - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

function

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..

.

Function .

In this article

function name([param,[, param,[..., param]]]) {
   [statements]
}
name

.

paramN

, . , , .

statements

, .

, , Function , . Function .

(. ).

undefined. , return, , .

,

, , . , Mozilla, , , ; . , .

JavaScript . , :

js
hoisted(); //  "foo"

function hoisted() {
  console.log("foo");
}

, :

js
notHoisted(); // TypeError: notHoisted   

var notHoisted = function () {
  console.log("bar");
};

function

, , a, b c.

js
function calc_sales(units_a, units_b, units_c) {
  return units_a * 79 + units_b * 129 + units_c * 699;
}

Specification
ECMAScript 2027 LanguageSpecification
# sec-function-definitions


Web Proxy Viewer  |  New URL  |  Original Page