Javascript- object slice

blossom0417
1 min readAug 5, 2020

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

--

--