make object readonly javascript

JavaScript
var obj = {};
Object.defineProperty(obj, "prop", {
    value: "test",
    writable: false
});
Source

Also in JavaScript: