<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<p id="demo"></p>
<script>
var person = {
firstName : "John",
lastName : "Doe",
age : 50,
eyeColor : "blue",
sum : function() {
return this.firstName + ' - '+this.lastName;
}
};
x=person; console.log(x); console.log(x.sum());
document.getElementById("demo").innerHTML =
person.firstName + " is " + person.age + " years old.";
</script>
<script id="jsbin-javascript">
console.log("==========================");
hblocks = {};
hcur = hblocks.firstHblock = 9;
hcur = hblocks.firstHblock2 = 99;
console.log('>>',hcur);
console.log(hblocks.firstHblock);
console.log(hblocks.firstHblock2);
console.log(hblocks);
console.log(JSON.stringify(hblocks));
/*
99
9
99
[object Object] {
firstHblock: 9,
firstHblock2: 99
}
"{\"firstHblock\":9,\"firstHblock2\":99}"
*/
var myObject = {
a : 11,
b : 22,
sum : function() {
return this.a + this.b;
}
};
x = myObject;
console.log(x.sum());
var HBlock = {
plugins: {},
litpro: {}
};
hcur = hblocks.firstHblock3 = HBlock;
hcur = hblocks.firstHblock3.litpro.a= 'aaaa';
hcur = hblocks.firstHblock3.litpro.b= 'bbbb';
console.log(hcur);
console.log(JSON.stringify(hcur));
//console.log(hcur.firstHblock);
console.log("--------------------------------");
var Dog = function() { // defining Dog constructor
this.hasTail = true; // defining a property
this.bark = function() { // defining a method property
console.log("wouf wouf");
};
};
var bobby = new Dog(); // instanciating the constructor
bobby.bark(); // print "wouf wouf" to the console
</script>
<script id="jsbin-source-javascript" type="text/javascript">console.log("==========================");
hblocks = {};
hcur = hblocks.firstHblock = 9;
hcur = hblocks.firstHblock2 = 99;
console.log('>>',hcur);
console.log(hblocks.firstHblock);
console.log(hblocks.firstHblock2);
console.log(hblocks);
console.log(JSON.stringify(hblocks));
/*
99
9
99
[object Object] {
firstHblock: 9,
firstHblock2: 99
}
"{\"firstHblock\":9,\"firstHblock2\":99}"
*/
var myObject = {
a : 11,
b : 22,
sum : function() {
return this.a + this.b;
}
};
x = myObject;
console.log(x.sum());
var HBlock = {
plugins: {},
litpro: {}
};
hcur = hblocks.firstHblock3 = HBlock;
hcur = hblocks.firstHblock3.litpro.a= 'aaaa';
hcur = hblocks.firstHblock3.litpro.b= 'bbbb';
console.log(hcur);
console.log(JSON.stringify(hcur));
//console.log(hcur.firstHblock);
console.log("--------------------------------");
var Dog = function() { // defining Dog constructor
this.hasTail = true; // defining a property
this.bark = function() { // defining a method property
console.log("wouf wouf");
};
};
var bobby = new Dog(); // instanciating the constructor
bobby.bark(); // print "wouf wouf" to the console</script></body>
</html>