0

I just want to completely remove the following line "666: {eng: 2, deu: 6}" from an object.

This is my object "words.score":

555: {eng: 1, deu: 5}
666: {eng: 2, deu: 6}
777: {eng: 3, deu: 7}
888: {eng: 4, deu: 8}

This is the result I'm expecting:

555: {eng: 1, deu: 5}
777: {eng: 3, deu: 7}
888: {eng: 4, deu: 8}

I tried this: Object.keys( words.score ).splice( 666, 1 );

And also this: words.score.splice( 666, 1 );

And also this: Words[score]splice( 666, 1 );

It does not work. How can I fix it?

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 1
    As a side note, **please** read the relevant documentation regarding [`.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice). `splice` works on indices - not values. – Chase Feb 15 '21 at 14:40
  • yes it works, thank you for the link and for the help ! :) – LesDentsDeLaMer Feb 15 '21 at 14:44

0 Answers0