The solution is to create an object and put all your constants in the object:
const={};
const.x=20;
const.y=30;
Object.freeze(const); // finally freeze the object
Usage:
var z=const.x + const.y;
Any attempt to modify the variable will generate an error:
const.x=100; <== raises error