What I learnt in JavaScript in 2 days — Finished building a “short game”!

I always had an impression that using Java / JS (JavaScript) as a language to write some piece of code and have it function properly is one of the toughest tasks out there as JavaScript is a very tough language and would take long long time to learn and a huge amount of effort….

BUT THIS IS SOOO Damn wrong:

I started learning JavaScript yesterday through Codecademy’s JavaScript track and here I am, after a few hours of work since yesterday, I am already up and running a super small game that has although nothing in it at the moment, but has completely changed my perception of JavaScript and removed the fear of having to overcome a huge challenge in order to learn JavaScript.

Here is my JavaScript code for the game that I just wrote this morning:

// Check if the user is ready to play!

confirm("Are you ready to play?");
var age = prompt("What's your age?");
if (age < 18)
	console.log("You are allowed to play but the system takes no responsibility!");
	console.log("Great, carry on playing! Wish you luck.");

console.log("Snow White and Batman were hanging out at the bus stop, waiting to go to the shops. There was a sale on and both needed some new threads. You've never really liked Batman. You walk up to him.");
console.log("Batman glares at you.");

var userAnswer = prompt("Are you feeling lucky, punk?");

if (userAnswer === "yes")
	console.log("Batman hits you very hard. It's Batman and you're you! Of course Batman wins!");
	console.log("You did not say yes to feeling lucky. Good choice! You are a winner in the game of not getting beaten up by Batman.");
var feedback = prompt("Please rate your game-play experience from 1 to 10");

if (feedback > 8)
	console.log("This is just the beginning of my game empire. Stay tuned for more!");
	console.log("I slaved away at this game and you gave me that score?! The nerve! Just you wait!");
This entry was posted in JavaScript and tagged , , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

One Response to What I learnt in JavaScript in 2 days — Finished building a “short game”!

  1. One thing that fascinates me is that Javascript is so easy to use if you just got an html document hosted on the web. Could you use this javascript embedded in your blog post or is a premium account needed for that? I would love to embed some javascript in my blog posts.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s