Run "Managing Entities" part existing in tutorial

Hi,
I want to run "Managing Entities" in "visualizing spatial data" part in tutorial. but i cant it,

This is so necessary.

"To see this in action, let’s use the Geometry Showcase example in Sandcastle. Copy and paste the below code near the top, immediately after the viewer is created.

function onChanged(collection, added, removed, changed){
  var msg = 'Added ids';
  for(var i = 0; i < added.length; i++) {
    msg += '\n' + added[i].id;
  }
}
viewer.entities.collectionChanged.addEventListener(onChanged);"

Thanks,

Hello,

The function is working for me. It looks like it’s missing a console.log to print out the message though.

Try this:

function onChanged(collection, added, removed, changed){
var msg = ‘Added ids’;
for(var i = 0; i < added.length; i++) {
msg += ‘\n’ + added[i].id;
}
console.log(msg);
}

``

I’ve updated the example and it should be on the website soon.

Best,

Hannah

Hello,

Thanks a lot, But i dont know to use this code in sample, please guide me for use this code in a sample.

Please give me that use this code in a whole sample.

Thank you,
Motamedi