SyntaxError: Unexpected token ':'

Hello there.

I have a question regarding one issue that I encountered. So I am going trough a book called Eloquent JavaScript and there is a part where the author is referring to a piece of code

let list = {
  value: 1,
  rest: {
    value: 2,
    rest: {
      value: 3,
      rest: null

and gives an additional explanation

A nice thing about lists is that they can share parts of their structure. For example, if I create two new values {value: 0, rest: list} and {value: -1, rest: list} (with list referring to the binding defined earlier), they are both independent lists, but they share the structure that makes up their last three elements. The original list is also still a valid three-element list.

First, I do not understand the point and second the piece of code

{value: 0, rest: list}
{value: -1, rest: list}

is returning an error.
If someone could tell me at least why am I getting an error or ideally to also explain the piece of text above.


Identifying a syntax error is pretty much impossible without seeing the full code that is throwing the error. I can tell you that “unexpected token” almost always means that you forgot to close something (in other words that you forgot a ), ', ", ], }, etc).