Get unlimited access
Open in app
Home
Notifications
Lists
Stories

Write
blossom0417
blossom0417

Aug 5, 2020

·
1 min read

Javascript- object slice

not an array slice

object slice

const foo = {
one: 'ONE',
two: 'TWO',
three: 'THRE',
four: 'FOUR',
}

const sliced = Object.fromEntries(
Object.entries(foo).slice(1, 3)
)

console.log(sliced)

#ref

https://stackoverflow.com/a/60548518/8249747

--

--

More from blossom0417

Love podcasts or audiobooks? Learn on the go with our new app.

Try Knowable

Recommended from Medium

Serhat Polat

Serhat Polat

Working with axios in React.js

addam davis

addam davis

How to Create a Loading Screen in Unity!

Brian Kyole

Brian Kyole

Building your weather application with node js

Dominik Januvka

Dominik Januvka

in

Frontend Weekly

Static Assets in Node.js Library

Melissa Wise

Melissa Wise

JavaScript is Breakfast: What we can Learn from Fluffy Stacks of Buttermilk Pancakes

SasaTsai

SasaTsai

JS Array的各種常見操作分類- 來掃一遍MDN Array fn吧

Rishabh Rathod

Rishabh Rathod

Implementing MIUI’s Wave Animation 🌊 Using React Native Reanimated v2

Final
Himanshu Gupta

Himanshu Gupta

Differences Between Component and Module in Angular

AboutHelpTermsPrivacy


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
blossom0417

blossom0417

More from Medium

Ajithrevildo

Ajithrevildo

REVIL-CLASS (Javascript)

Abhineet singh

Abhineet singh

JavaScript Holy Grail — Part 1 : Arrays

Jeshika Sapkota

Jeshika Sapkota

in

Dev Genius

JavaScript DOM

Muntaza Kehase

Muntaza Kehase

ECMAScript Javascript

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Knowable