Since the ECMA-262 specifications Javascript has gained the Object.freeze() method, which allows for objects, whose properties can not be changed, added or removed.
Instead of freeze, use spread operator to copy things without modifying them (if you are using a transpiler, of course):
const second = { ...first, test: 20 }