How to calculate area of 3D buildings?

How can I mark out the area on the map to calculate its area of the 3D building?

Please try give me a code example.

There isn’t anything in CesiumJS that can do that out-of-the-box, but we have a set of commercial widgets built on top of CesiumJS for measuring area among other things:

We’re also working on putting this into Cesium ion over the next few months so you can just make these measurements on your data in your account.