题目
请补全JavaScript函数,要求将字符串参数转换为对象的形式返回。
示例:
1. typeof string === 'string' -> typeof _stringtoobject(string) === 'object'
编辑
核心代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>对象字符串</title> </head> <body> <!-- 请补全JavaScript函数,要求将字符串参数转换为对象的形式返回。 示例: 1. typeof string === 'string' -> typeof _stringtoobject(string) === 'object' --> <script>function _stringtoobject(string) { // 补全代码 return</script> </body> </html>
总结
直接返回对象即可 比较简答理解