Baseline Widely available
slice()
㯠TypedArray
ã¤ã³ã¹ã¿ã³ã¹ã®ã¡ã½ããã§ãåä»ãé
åã®ä¸é¨ã start
ãã end
ï¼end
ã¯å«ã¾ããªãï¼ã¾ã§é¸æãããæ°ããåä»ãé
åãªãã¸ã§ã¯ãã«ã³ãã¼ãã¦è¿ãã¾ããå
ã®åä»ãé
åã¯å¤æ´ããã¾ããããã®ã¡ã½ãã㯠Array.prototype.slice()
ã¨åãã¢ã«ã´ãªãºã ã§ãã
const uint8 = new Uint8Array([10, 20, 30, 40, 50]);
const array1 = uint8.slice(1, 3);
console.log(array1);
// Expected output: Uint8Array [20, 30]
æ§æ
slice()
slice(start)
slice(start, end)
弿°
start
çç¥å¯
æ½åºãå§ããä½ç½®ã示ãã¼ãåºç¹ã®ã¤ã³ããã¯ã¹ã§ãæ´æ°ã«å¤æããã¾ãã
end
çç¥å¯
æ½åºãçµäºããä½ç½®ã示ãã¼ãåºç¹ã®ã¤ã³ããã¯ã¹ã§ãæ´æ°ã«å¤æããã¾ãã slice()
ã¯ããã¾ã§ãæ½åºãã¾ããã end
ã¯å«ã¿ã¾ããã
æ½åºãããè¦ç´ ãå ¥ã£ãæ°ããåä»ãé åã§ãã
解説詳細ã«ã¤ãã¦ã¯ã Array.prototype.slice()
ãã覧ãã ããããã®ã¡ã½ããã¯æ±ç¨çã§ã¯ãªããåä»ãé
åã¤ã³ã¹ã¿ã³ã¹ã«å¯¾ãã¦ã®ã¿å¼ã³åºããã¨ãã§ãã¾ãã
const uint8 = new Uint8Array([1, 2, 3]);
uint8.slice(1); // Uint8Array [ 2, 3 ]
uint8.slice(2); // Uint8Array [ 3 ]
uint8.slice(-2); // Uint8Array [ 2, 3 ]
uint8.slice(0, 1); // Uint8Array [ 1 ]
仿§æ¸ ãã©ã¦ã¶ã¼ã®äºææ§ é¢é£æ
å ±
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4