From de336e48ad7253b470c9b6bb8f3752fc34de3e32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=BA=86=E5=BC=BA?= Date: Fri, 15 Dec 2023 10:31:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20231214\345\244\215\344\271\240.md" | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 "17 \350\221\243\345\272\206\345\274\272/20231214\345\244\215\344\271\240.md" diff --git "a/17 \350\221\243\345\272\206\345\274\272/20231214\345\244\215\344\271\240.md" "b/17 \350\221\243\345\272\206\345\274\272/20231214\345\244\215\344\271\240.md" new file mode 100644 index 0000000..c30da87 --- /dev/null +++ "b/17 \350\221\243\345\272\206\345\274\272/20231214\345\244\215\344\271\240.md" @@ -0,0 +1,23 @@ +```js +Reflect.apply( + Math.floor, // 目标函数,要调用哪个函数(必写) + null, // 调用函数时绑定的this对象(可选) + [1.31] // 目标函数调用是传入的实参列表,一般是一个类数组的对象(可选) +) + + +Reflect.set(obj, 'name', '李四') // 返回T|F + +const price = 100.2 +Reflect.apply(price > 100 ? Math.floor : Math.ceil, null, [price]) // 100 + + +const date = Reflect.construct( + Date, // 被运行的目标函数(必写) + []) // 调用构造函数的数组或伪数组(可选) +console.log(date.getTime()); +``` + +``` + +``` -- Gitee