Created
November 1, 2022 11:54
-
-
Save nmaxcom/76f97f51b23c8b535520afa580db1205 to your computer and use it in GitHub Desktop.
More concise way of pushing only a few obj keys into an array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bigObj = { | |
title: "BLabla", | |
text: "sda nasd asld asdjas dsa dlajsd sdjdalsdj dasjd asdkj", | |
bu: "kjjk", | |
bla: 32, | |
image: "https://www.blup.com/blabla.png", | |
}; | |
let arr = []; | |
const { title, text, image } = bigObj; | |
const reducedObj = { title, text, image }; | |
arr.push(reducedObj); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment