Error Setting up ReplicaSet

I’m new to mongo and was doing this training exercise. These are the steps I took.
I get an error when I execute the rs.initiate.

@rem Primary 
start "a" mongod --dbpath /users/userxx/mongo/data/db1 --port 30000 --replSet "demo"
@rem Secondary
start "b" mongod --dbpath /users/userxx/mongo/data/db2 --port 40000 --replSet "demo"
@rem Arbiter
start "c" mongod --dbpath /users/userxx/mongo/data/db3 --port 50000 --replSet "demo"
> var demoConfig={ _id: "demo", members: [{_id: 0, host: 'localhost: 30000', priority: 10 }, {_id: 1, host: 'localhost: 40000' }, {_id: 2, host: 'localhost: 50000', arbiterOnly: true }] };

> demoConfig
{
        "_id" : "demo",
        "members" : [
                {
                        "_id" : 0,
                        "host" : "localhost: 30000",
                        "priority" : 10
                },
                {
                        "_id" : 1,
                        "host" : "localhost: 40000"
                },
                {
                        "_id" : 2,
                        "host" : "localhost: 50000",
                        "arbiterOnly" : true
                }
        ]
}

> rs.initiate(demoConfig)
{
        "ok" : 0,
        "errmsg" : "member: { _id: 0.0, host: \"localhost: 30000\", priority: 10.0 } :: caused by :: Did not consume whole string.",
        "code" : 93,
        "codeName" : "InvalidReplicaSetConfig"
}

Hello @Karl_NewUser, Welcome to the MongoDB Community forum!

The demoConfig data looks fine. It maybe that there is some kind of special character embedded somewhere in the config object content, and that is causing the error.

I tried the following on my machine and this works fine. The config object I copied from your code has the issue (I got the same error), so I typed the config info manually again, tried and found it okay!

rs.initiate({
    _id : "myrset",
    members: [
        { _id: 0, host: "localhost:27011", priority: 10 },
        { _id: 1, host: "localhost:27012" },
        { _id: 3, host: "localhost:27013", arbiterOnly: true }
    ]
})

I got this result, and then tried rs.status() as okay too:

{
        "ok" : 1,
        "$clusterTime" : {
                "clusterTime" : Timestamp(1645697604, 1),
                "signature" : {
                        "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                        "keyId" : NumberLong(0)
                }
        },
        "operationTime" : Timestamp(1645697604, 1)
}