标签:运算 对象 log 一个 its nbsp rap turn 转化
有时候,出于某种目的,需要将数组转化成对象,一个简单快速的方法是就使用展开运算符号(...):
var fruits = [“banana”, “apple”, “orange”, “watermelon”]; var fruitsObj = { …fruits }; console.log(fruitsObj); // returns {0: “banana”, 1: “apple”, 2: “orange”, 3: “watermelon”, 4: “apple”, 5: “orange”, 6: “grape”, 7: “apple”}
标签:运算 对象 log 一个 its nbsp rap turn 转化
原文地址:https://www.cnblogs.com/ll15888/p/11988415.html