Javascript getter syntax demo

Below javascript code will use the JS getter syntax to show an alert box with random float value.

var random_v = Math.random();
var obj = {
	get hello() {
		return random_v;
	}
}
alert(obj.hello);

Javascript get syntax binds an object property to a function that will be called when that property is looked up — MDN