Computer >> 컴퓨터 >  >> 프로그램 작성 >> JavaScript

JavaScript의 TypedArray.subarray() 함수

<시간/>

TypedArray 객체의 subarray() 함수는 현재 배열의 일부를 반환합니다. 하위 배열의 시작과 끝을 나타내는 두 개의 숫자를 허용합니다.

구문

구문은 다음과 같습니다.

typedArray.subarray(5, 9)

예시

<html>
<head>
   <title>JavaScript Example</title>
</head>
<body>
   <script type="text/javascript">
      var typedArray = new Int32Array([111, 56, 62, 40, 75, 36, 617, 2, 139, 827 ]);
      var result = typedArray.subarray(3, 7);
      document.write("Contents of the typed array: "+result);
   </script>
</body>
</html>

출력

Contents of the typed array: 40,75,36,617