Baseline Widely available
éç㪠Reflect.apply()
ã¡ã½ããã¯ãæå®ããã弿°ã¨ã¨ãã«å¯¾è±¡ã¨ãªã颿°ãå¼ã³åºãã¾ãã
console.log(Reflect.apply(Math.floor, undefined, [1.75]));
// Expected output: 1
console.log(
Reflect.apply(String.fromCharCode, undefined, [104, 101, 108, 108, 111]),
);
// Expected output: "hello"
console.log(
Reflect.apply(RegExp.prototype.exec, /ab/, ["confabulation"]).index,
);
// Expected output: 4
console.log(Reflect.apply("".charAt, "ponies", [3]));
// Expected output: "i"
æ§æ
Reflect.apply(target, thisArgument, argumentsList)弿°
target
å¼ã³åºã対象ã®é¢æ°ã
thisArgument
target
ã®å¼ã³åºãéã® this
å¤ãæä¾ããã
argumentsList
target
ã¨ä¸ç·ã«å¼ã³åºã弿°ãæå®ããé
å風ãªãã¸ã§ã¯ãã
æå®ããã target
å¤ã¨å¼æ°ã®æ¡ä»¶ã§å¯¾è±¡ã®é¢æ°ãå¼ã³åºããã¨ãã®çµæã§ãã
TypeError
: target
ãå¼ã³åºããªãå ´åã
ES5 ã§ã¯ããµã¤ã Function.prototype.apply()
ã¡ã½ããã使ç¨ãããã¨ã§ãæå®ããã this
ã®å¤ã¨ arguments
ã§é
å (ã¾ã㯠é
å風ãªãã¸ã§ã¯ã) ã«ãã弿°ãæå®ãããã¨ã§ã颿°ãå¼ã³åºããã¨ãã§ãã¾ãã
Function.prototype.apply.call(Math.floor, undefined, [1.75]);
Reflect.apply()
ã使ãã¨ãããã»ã©åé·ã§ã¯ãªãçè§£ãããããªãã¾ãã
Reflect.apply(Math.floor, undefined, [1.75]);
// 1;
Reflect.apply(String.fromCharCode, undefined, [104, 101, 108, 108, 111]);
// "hello"
Reflect.apply(RegExp.prototype.exec, /ab/, ["confabulation"]).index;
// 4
Reflect.apply("".charAt, "ponies", [3]);
// "i"
仿§æ¸ ãã©ã¦ã¶ã¼ã®äºææ§ é¢é£æ
å ±
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