列表

详情


FED21. 检测复杂数据类型

描述

请补全JavaScript函数,要求以Boolean的形式返回第一个参数是否属于第二个参数对象的实例。

原站题解

HTML/CSS/JavaScript 解法, 执行用时: 1681ms, 内存消耗: 77812KB, 提交时间: 2022-02-08

{"css":"","js":"function _instanceof(left,right) {\n    // 补全代码\n                    return Boolean(left instanceof right)\n\n}","html":"","libs":[]}

HTML/CSS/JavaScript 解法, 执行用时: 1682ms, 内存消耗: 77812KB, 提交时间: 2022-02-09

{"css":"","js":"function _instanceof(left,right) {\n    // 补全代码\n    return (left instanceof right)\n    \n}","html":"","libs":[]}

HTML/CSS/JavaScript 解法, 执行用时: 1737ms, 内存消耗: 77856KB, 提交时间: 2021-12-31

{"css":"","js":"function _instanceof(left,right) {\n    // 补全代码\n    let flag = false\n            while (left.__proto__) {\n                if (left.__proto__.constructor == right) {\n                    flag = true\n                    break\n                }\n                left = left.__proto__\n            }\n            return flag\n}","html":"","libs":[]}

HTML/CSS/JavaScript 解法, 执行用时: 1737ms, 内存消耗: 77868KB, 提交时间: 2021-12-07

{"css":"","js":"function _instanceof(left,right) {\n    // 补全代码\n    return  left instanceof right;\n}","html":"","libs":[]}

HTML/CSS/JavaScript 解法, 执行用时: 1740ms, 内存消耗: 77804KB, 提交时间: 2021-12-07

{"css":"","js":"function _instanceof(left,right) {\n    // 补全代码\n    return Boolean(left instanceof  right);\n}","html":"","libs":[]}

上一题