Apply new format to snippets and template
This commit is contained in:
@ -5,8 +5,8 @@ tags: object,intermediate
|
||||
|
||||
Creates a new object from the specified object, where all the keys are in lowercase.
|
||||
|
||||
Use `Object.keys()` and `Array.prototype.reduce()` to create a new object from the specified object.
|
||||
Convert each key in the original object to lowercase, using `String.toLowerCase()`.
|
||||
- Use `Object.keys()` and `Array.prototype.reduce()` to create a new object from the specified object.
|
||||
- Convert each key in the original object to lowercase, using `String.toLowerCase()`.
|
||||
|
||||
```js
|
||||
const lowercaseKeys = obj =>
|
||||
@ -19,4 +19,4 @@ const lowercaseKeys = obj =>
|
||||
```js
|
||||
const myObj = { Name: 'Adam', sUrnAME: 'Smith' };
|
||||
const myObjLower = lowercaseKeys(myObj); // {name: 'Adam', surname: 'Smith'};
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user