"你可以使用 JSON.parse() 方法将字符串转换为数组。\n\njavascript\nlet str = \"["image\/36\/8b41e5cb5e45d3dac69c9c458428078affedee.jpg","image\/4a\/62e716ab3d22d8596946d328ff888705293195.jpg"]\" ;\nlet arr = JSON.parse(str);\nconsole.log(arr);\n\n\n输出结果为:\n\njavascript\n["image\/36\/8b41e5cb5e45d3dac69c9c458428078affedee.jpg", "image\/4a\/62e716ab3d22d8596946d328ff888705293195.jpg"]\n\

JavaScript 字符串转数组:将字符串分割成两项数组

原文地址: http://www.cveoy.top/t/topic/psIZ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录