Baseline Widely available
some()
ë©ìëë íìí ë°°ì´ ë´ ì¼ë¶ ììê° ì ê³µëë í¨ìì ìí´ êµ¬íëë í
ì¤í¸ë¥¼ íµê³¼íëì§ ì¬ë¶ë¥¼ í
ì¤í¸í©ëë¤. ì´ ë©ìëë Array.prototype.some()
ê³¼ ê°ì ìê³ ë¦¬ì¦ì
ëë¤. TypedArrayë ì¬ê¸° TypedArray ê°ì²´ ì í ì¤ íëì
ëë¤.
function isNegative(element, index, array) {
return element < 0;
}
const int8 = new Int8Array([-10, 20, -30, 40, -50]);
const positives = new Int8Array([10, 20, 30, 40, 50]);
console.log(int8.some(isNegative));
// Expected output: true
console.log(positives.some(isNegative));
// Expected output: false
구문
typedarray.some(callback[, thisArg])
매ê°ë³ì
callback
ê° ììì ëí´ í
ì¤í¸íë í¨ì, ë¤ì ì¸ì ì
ì ì·¨íë:_ currentValue
_ : íìí ë°°ì´ìì íì¬ ì²ë¦¬ ì¤ì¸ ìì.
index
íìí ë°°ì´ìì íì¬ ì²ë¦¬ ì¤ì¸ ììì ì¸ë±ì¤.
array
some
ì´ í¸ì¶í íìí ë°°ì´.
thisArg
ì í ì¬í. callback
ì ì¤íí ë this
ë¡ì ì¬ì©íë ê°.
some
ë©ìëë callback
ì´ true ê°ì ë°ííë ìì를 ì°¾ì ëê¹ì§ íìí ë°°ì´ì ìë ê° ììì ëí´ í ë² callback
í¨ì를 ì¤íí©ëë¤. ê·¸ë° ììê° ë°ê²¬ë ê²½ì°, some
ì ì¦ì true
를 ë°íí©ëë¤. ê·¸ë ì§ ìì¼ë©´, some
ì false
를 ë°íí©ëë¤.
callback
ì ì¸ ì¸ìì í¨ê» í¸ì¶ë©ëë¤: ììê°, ìì ì¸ë±ì¤ ë° ìí(traverse)ëë ë°°ì´ ê°ì²´.
thisArg
매ê°ë³ìê° some
ì ì ê³µëë ê²½ì°, í¸ì¶ë ë callback
ì ì ë¬ë©ëë¤, ê·¸ this
ê°ì¼ë¡ ì¬ì©í기 ìí´. ê·¸ë ì§ ìì¼ë©´, undefined
ê°ì´ ê·¸ this
ê°ì¼ë¡ ì¬ì©í기 ìí´ ì ë¬ë©ëë¤. callback
ì ìí´ ê²°êµ ê´ì°°í ì ìë this
ê°ì í¨ìì ìí´ ë³´ì´ë this
를 ê²°ì íë íì ê·ì¹ì ë°ë¼ ê²°ì ë©ëë¤.
some
ì í¸ì¶ë íìí ë°°ì´ì ë³íìí¤ì§(mutate) ììµëë¤.
ë¤ì ìë íìí ë°°ì´ì 모ë ììê° 10ë³´ë¤ ë í°ì§ í ì¤í¸í©ëë¤.
function isBiggerThan10(element, index, array) {
return element > 10;
}
new Uint8Array([2, 5, 8, 1, 4]).some(isBiggerThan10); // false
new Uint8Array([12, 5, 8, 1, 4]).some(isBiggerThan10); // true
íì´í í¨ì를 ì¬ì©íì¬ íìí ë°°ì´ ìì í
ì¤í¸
íì´í í¨ìë ê°ì í ì¤í¸ì ëí´ ë ì§§ì 구문ì ì ê³µí©ëë¤.
new Uint8Array([2, 5, 8, 1, 4]).some((elem) => elem > 10); // false
new Uint8Array([12, 5, 8, 1, 4]).some((elem) => elem > 10); // true
ëª
ì¸ ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
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