Skip to content

Commit e7e02b2

Browse files
Added Object methods
1 parent f7ce465 commit e7e02b2

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

_posts/2019-11-28-Commonly used JavaScript functions.markdown

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ Following methods are used for filtering and transforming an array.
5151
- [splice()][Array.prototype.splice()] - This method modifies the contents of the array by adding or removing new elements in-place.
5252
- [join()][Array.prototype.join()] - This method is the opposite of [String.prototype.split()][String.prototype.split()]. It creates and returns a new string by concatenating all array elements, separating them by a specified separator string.
5353

54+
## Object methods
55+
Following are some of the common methods from the [Object][Object] global object.
56+
57+
- [keys()][Object.keys()] - This method returns an array of a given object's own enumerable property names, in the same order as we get with a normal loop.
58+
- [values()][Object.values()] - This method returns an array of a given object's own enumerable property values, in the same order as that provided by a [for...in][for...in] loop.
59+
- [entries()][Object.entries()] - This method returns an array of a given object's own enumerable string-keyed property `[key, value]` pairs, in the same order as that provided by a [for...in][for...in] loop.
60+
- [fromEntries()][Object.fromEntries()] - This method is the opposite of `Object.entries()`. It transforms a list of key-value pairs into an object.
61+
62+
One of the best ways to learn more these methods is to click on their links, read the documentation, and play around with some examples.
63+
5464
[String]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
5565
{:target="_blank"}
5666
[String.prototype.indexOf()]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf
@@ -94,4 +104,17 @@ Following methods are used for filtering and transforming an array.
94104
[Array.prototype.splice()]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
95105
{:target="_blank"}
96106
[Array.prototype.join()]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join
97-
{:target="_blank"}
107+
{:target="_blank"}
108+
109+
[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
110+
{:target="_blank"}
111+
[Object.keys()]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
112+
{:target="_blank"}
113+
[Object.values()]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values
114+
{:target="_blank"}
115+
[for...in]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in
116+
{:target="_blank"}
117+
[Object.entries()]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
118+
{:target="_blank"}
119+
[Object.fromEntries()]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries
120+
{:target="_blank"}

0 commit comments

Comments
 (0)