전역함수의 설정
코딩을 줄이는 가장 간단한 두 가지 방법
첫 번째는 전역함수를 선언하여 인스턴스마다 따로 해주어야하는 코딩을 메인타임라인으로 집중시키는 것이다.
var diffX = X2-X1;
var diffY = Y2-Y1;
distance = Math.floor(Math.sqrt(diffX*diffX+diffY*diffY));
return distance;
};
위의 예시는 두 개의 좌표(X1, Y1), (X2,Y2) 사이의 거리를 계산하는
아주아주 간단한(ㅜ ㅜ) 전역함수의 설정이다.
About this entry
You’re currently reading “전역함수의 설정,” an entry on multiplicité
- Published:
- Tuesday, October 21st, 2003 at 1:06 am
- This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 Korea.
- Author:
- vizualizer
- Category:
- techne
No comments
Jump to comment form | comments rss