Get Programming with JavaScript - Listing 3.12
Listing 3.12 - A blog post
JS Bin
var post = {
id : 1,
title : "My Crazy Space Adventure",
author : "Philae",
created : "2015-06-21",
body : "You will not believe where I just woke up!! Only on a comet..."
};
Further Adventures
Listing 3.12 - A blog post - Task 1
- Display some of the properties.
var post = {
id : 1,
title : "My Crazy Space Adventure",
author : "Philae",
created : "2015-06-21",
body : "You will not believe where I just woke up!! Only on a comet..."
};
// log some of the properties
console.log(post.title);
console.log("posted by " + post.author + " on " + post.created);
console.log(post.body);
Listing 3.12 - A blog post - Task 2
var post = {
id : 1,
title : "My Crazy Space Adventure",
author : "Philae",
created : "2015-06-21",
body : "You will not believe where I just woke up!! Only on a comet..."
};
var post2 = {
id : 2,
title : "I'm Going On An Adventure!",
author : "BB",
created : "2012-12-12",
body : "I'm off with some dwarves and a wizard."
};