当前位置: 首页 > 文档资料 > Lazy.js 英文文档 >

toArray

优质
小牛编辑
138浏览
2023-12-01

Creates an array from the key/value pairs in this sequence.

Signature

ObjectLikeSequence.toArray = function() { /*...*/ }
ObjectLikeSequence.toArray = function toArray() {
  return this.pairs().toArray();
}
NameType(s)Description
returnsArray

An array of [key, value] elements.

Examples

var colorCodes = {
  red: "#f00",
  green: "#0f0",
  blue: "#00f"
};

Lazy(colorCodes).toArray() // => [["red", "#f00"], ["green", "#0f0"], ["blue", "#00f"]]