Create 2 line , how hide or show these lines individually

I have drawn two lines based on the code below.

changeLinePrimitive.prototype.getGeometry = function ()
	{
		//console.log(this.id);
			return new Cesium.PolylineGeometry({
			positions: this.positions,
			
			width: 5.0,
			vertexFormat: Cesium.PolylineColorAppearance.VERTEX_FORMAT,    
			colorsPerVertex: false,
			
			colors:ArrayColors,
			
			clampToGround: true
		});
	};
	
	changeLinePrimitive.prototype.update = function (context, frameState, commandList)
	{
		//console.log(commandList);
		var geometry = this.getGeometry();
		if (!geometry)
		{
			return;
		}

		primitive1 = new Cesium.Primitive
		({
			geometryInstances: new Cesium.GeometryInstance
			({
				geometry: geometry,
				id: ind

			}),
			
			allowPicking: true,
			appearance: new Cesium.PolylineColorAppearance
			({
				translucent: false
			}),
			asynchronous: false
		});
		
		
		
		primitive1.update(context, frameState, commandList);
	};

var positionWord1 = [];
positionWord1.push(Cesium.Cartesian3.fromDegrees(46, 37,200000));
		positionWord1.push(Cesium.Cartesian3.fromDegrees(49, 33,200000));
		
		var pr=new changeLinePrimitive({positions: positionWord1,id:ind});
		console.log(pr)
		viewer.scene.primitives.add(pr);


var positionWord2 = [];

positionWord2.push(Cesium.Cartesian3.fromDegrees(58, 27,200000));
		positionWord2.push(Cesium.Cartesian3.fromDegrees(70, 37,200000));
		
		var pr=new changeLinePrimitive({positions: positionWord2,id:ind});
		console.log(pr);
		viewer.scene.primitives.add(pr);

But I can’t hide or show these lines individually.

Please give me some advice.

The Primitive has a show property. Setting this to false should hide the primitive.

var attributes = primitive.getGeometryInstanceAttributes(id);
attributes.show = Cesium.ShowGeometryInstanceAttribute.toValue(false);

It does not give an error.
but It cannot be hidden.

It’s not clear what the code that you posted refers to. When you create a primitive like
primitive1 = new Cesium.Primitive(...)
then you can later set
primitive1.show = false;
and that should hide the primitive.

For better, quicker, and more specific help, it is generally useful to create a Cesium Sandcastle that illustrates you current approach and the question.