Returns an array of function property names from own and inherited enumerable properties of object.
Use Object.keys(obj) and Object.get.PrototypeOf(obj) to iterate over the object's own and inherited properties, Array.filter() to keep only those that are functions. Use the spread operator (...) to combine all returned property names into one array.
const functionsIn = obj => +
Returns an array of function property names from own and inherited enumerable properties of object.
Use Object.keys(obj) and Object.get.PrototypeOf(obj) to iterate over the object's own and inherited properties, Array.filter() to keep only those that are functions. Use the spread operator (...) to combine all returned property names into one array.
const functionsIn = obj => [...Object.keys(obj), ...Object.keys(Object.getPrototypeOf(obj))].filter( key => typeof obj[key] === 'function' ); @@ -1234,6 +1234,7 @@ Logs: { + const newPost = { "userId": 1, "id": 1337, diff --git a/snippets/httpPost.md b/snippets/httpPost.md index 7334a93cf..786e44a8b 100644 --- a/snippets/httpPost.md +++ b/snippets/httpPost.md @@ -37,6 +37,7 @@ const httpPost = (url, callback, data = null, err = console.error) => { + const newPost = { "userId": 1, "id": 1337,