본문 바로가기

WEB/JavaScript

function, property, method 정의








자바스크립트 표준문서 http://www.ecma-international.org 에서 발췌 


함수, 프로퍼티, 메소드 용어정의 

4.3.28function

member of the Object type that may be invoked as a subroutine

NOTEIn addition to its properties, a function contains executable code and state that determine how it behaves when invoked. A function’s code may or may not be written in ECMAScript.

subroutine[각주:1] 형태로 호출되는 객체타입 정도로 해석된다.


자바스크립트에서는 함수도 객체취급



4.3.30property

part of an object that associates a key (either a String value or a Symbol value) and a value

NOTEDepending upon the form of the property the value may be represented either directly as a data value (a primitive value, an object, or a function object) or indirectly by a pair of accessor functions.

키와 값이 연관된 객체의 부분


객체내의 변수라고 생각하면 편하다.



4.3.31method

function that is the value of a property

NOTEWhen a function is called as a method of an object, the object is passed to the function as its this value.

property의 값인 함수


객체 내에서 정의된 함수를 뜻한다.




정리하면,


함수가 메소드보다 더 큰 개념이며 객체 내에서 정의된 함수는 메소드라고 부른다.




  1. subroutine: 독립적이며 반복적으로 사용되는 명령 [본문으로]

'WEB > JavaScript' 카테고리의 다른 글

json이란  (0) 2018.06.19
use strict란  (0) 2018.04.02
Closure  (0) 2018.03.30
호이스팅  (0) 2018.03.30
scope  (0) 2018.03.29