keys
优质
小牛编辑
139浏览
2023-12-01
Returns a Sequence whose elements are the keys of this object-like sequence.
Signature
ObjectLikeSequence.keys = function() { /*...*/ }
ObjectLikeSequence.keys = function keys() { return new KeySequence(this); }
Name | Type(s) | Description |
---|---|---|
returns | Sequence | The sequence based on this sequence's keys. |
Examples
var obj = { hello: "hola", goodbye: "hasta luego" }; Lazy(obj).keys() // sequence: ["hello", "goodbye"] Lazy(obj).keys().map(function(v, i) { return [v, i]; }) // sequence: [["hello", 0], ["goodbye", 1]]