Deep copy object in Javascript?

Cloneable is not available in the JS backend (see KT-6639). I’ll probably just implement a custom copy method.