列表

详情


FED33. 对象字符串

描述

请补全JavaScript函数,要求将字符串参数转换为对象的形式返回。
示例:
1. typeof string === 'string' -> typeof _stringtoobject(string) === 'object'

原站题解

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

{"css":"","js":"function _stringtoobject(string) {\n    // 补全代码\n    return new String(string)\n}","html":"","libs":[]}

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

{"css":"","js":"function _stringtoobject(string) {\n    // 补全代码\n    return new String(string);\n    return {string}\n}","html":"","libs":[]}

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

{"css":"","js":"function _stringtoobject(string) {\n    // 补全代码\n   return Object(string) \n}","html":"","libs":[]}

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

{"css":"","js":"function _stringtoobject(string) {\n    // 补全代码\n    return {string};\n}","html":"","libs":[]}

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

{"css":"","js":"function _stringtoobject(string) {\n    // 补全代码\n   return new String(string)\n}","html":"","libs":[]}

上一题