Javascript- object slice

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

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





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

Recommended from Medium

JavaScript Scope and Scope Chain

LeetCode 1810: Minimum Path Cost in a Hidden Grid

Everything You Need To Know About Face Changing App And How Much Will It Cost You?

Add YouTube player to flutter app


Migrating 2,000+ Specs from Karma to Jest

Nike Air Zoom Wildhorse 3 GTX

The Linked List Data Structure

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


More from Medium

Fun with Promises in Javascript

padEnd() JavaScript

ES6 JavaScript

How to get all previous items of an array in js from a certain value