개발자

javascript with 구문

쿠카곰돌이 2020. 8. 19. 06:20
반응형

with구문은 다음과 같이 객체의 이름과 점(dot) 없이 기술 할 수 있습니다.

Syntax

with (object) { properties used without the object name and dot }

 

일반적으로 사용 할 떄

x = Math.cos(1 * Math.PI) + Math.sin(Math.LN5)
y = Math.tan(2 * Math.E)

with 구문

with (Math){
  x = cos(1 * PI) + sin (LN5)
  y = tan(2 * E)
}


※ The ‘with’ keyword is used as a kind of shorthand for referencing an object's properties or methods.

The object specified as an argument to with becomes the default object for the duration of the block that follows. The properties and methods for the object can be used without naming the object.




반응형

'개발자' 카테고리의 다른 글

java 연동 callablestatement  (0) 2020.12.14
음력 변환 프로그램 자바(Java) 소스  (0) 2020.09.29
JavaScript 페이지이동  (0) 2020.08.19
JavaScript 함수  (0) 2020.08.19
HTML 5 Standard Events  (0) 2020.08.19