Javascript [Electronic resources] : The Definitive Guide (4th Edition) نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Javascript [Electronic resources] : The Definitive Guide (4th Edition) - نسخه متنی

David Flanagan

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید

Availability


JavaScript 1.0; JScript 1.0; ECMAScript
v1

Inherits from/Overrides


Inherits from Object


Synopsis

function functionname(argument_name_list) // Function definition statement
{
body
}
function (argument_name_list) { body } // Unnamed function literal; JavaScript 1.2
functionname
(argument_value_list) // Function invocation

Constructor


new Function(argument_names..., body) // JavaScript 1.1 and later

Arguments


argument_names...

Any number of string arguments, each naming one or more arguments of
the Function object being created.

body

A string that specifies the body of the function. It may contain any
number of JavaScript statements, separated with semicolons, and may
refer to any of the argument names specified by previous arguments to
the constructor.


Returns


A newly created Function object. Invoking the function executes the
JavaScript code specified by body.


Throws


SyntaxError

Indicates that there was a JavaScript syntax error in the
body argument or in one of the
argument_names arguments.


Properties


arguments[]

An array of arguments that were passed to the function. Deprecated.

caller

A reference to the Function object that invoked this one, or
null if the function was invoked from top-level
code. Deprecated.

length

The number of named arguments specified when the function was
declared.

prototype

An object which, for a constructor function, defines properties and
methods shared by all objects created with that constructor function.


Methods


apply( )

Invokes a function as a method of a specified object, passing a
specified array of arguments.

call( )

Invokes a function as a method of a specified object, passing the
specified arguments.

toString( )

Returns a string representation of the function.


Description


A
function is a fundamental data type in JavaScript. Chapter 7 explains how to define and use functions, and
Chapter 8 covers the related topics of methods,
constructors, and the prototype property of
functions. See those chapters for complete details. Note that
although function objects may be created with the Function(
) constructor described here, this is not efficient, and
the preferred way to define functions, in most cases, is with a
function definition statement or a function literal.

In JavaScript 1.1 and later, the body of a function is automatically
given a local variable, named arguments,
that refers to an Arguments object. This object is an array of the
values passed as arguments to the function. Don't confuse this
with the deprecated arguments[] property listed
above. See the Arguments reference page for details.


See Also


Arguments; Chapter 7; Chapter 8

/ 844