// Please notice that ';' is optional (i.e Python/Ruby/CoffeScript style)
// but it's a good practice to put them.
// Also putting 'var' before variable definition is not required
var str = 'What is your problem?'; // string
var strNum = '240.40'; // string to number
var num = 178; // number
// arrays
var numbers = [1, 2, 3, 4, 5];
var strings = ['a', 'b', 'c', 'd'];
// object
var obj = {
 name: 'Me again',
 age: 37,
 working: function work(err, data){
 return false;
 },
 future: {
 Servers: ['Nginx', 'Apache', 'Gunicorn', 'Node'],
 howMuch: 190,
 status: 'working...'
 },
 programming: ['Python', 'Javascript', 'PHP', 'Ruby']
}
switch(num) {
 case 80:
 case 90: 
 console.log('Whoops!');
 break;
 case 178:
 console.log('Horray!');
 break;
 default:
 console.log('Try again!');
}
// Ternary Operator
var isCorrect = (num > 178) ? true : false;
console.log("isCorrect: ", isCorrect);
// Loops
// while
while(1==2) {
 // do
}
// do
do {
 // do
} while(1==2)
// use 'break' and 'continue' in for loop
// objects
for(k in obj) { // you can also do this: for (var k in obj)
 console.log(obj[k]);
}
// you can do this
console.log('FUTURE: ', obj.future.status);
// String - Arrays
// convert string to array 
var arr = str.split(' ');
console.log(arr);
// convert array to string
var str2 = arr.join(' ');
console.log(str2);
// String
console.log('Full String: ', str);
console.log('Length: ', str.length); // length
console.log('Slice 5, 10: ', str.slice(5, 10)); // start, end point
console.log('Slice 5:', str.slice(5)); // start --> end of string
console.log('substr 5, 10: ', str.substr(5, 10)); // start, length
console.log('indexOf(\'problem\'): ', str.indexOf('problem')); // index of certain word
console.log('split(\'\'): ', str.split(' ')); // to array
console.log('Replace \'your\' with \'my\ and \'?\' with \'!\': ', str.replace('your', 'my').replace('?', '!'));
console.log('Bold: ', str.bold()); // big(), fontcolor(), fontsize(), italics(), small()
 // strike(), sub(), sup(), link()
// Misc
console.log('Number(strNum): ', Number(strNum));
console.log('parseInt(strNum): ', parseInt(strNum));
console.log('parseFloat: ', parseFloat(strNum));
console.log('num.toString: ', num.toString());
console.log('Numbers: ', numbers);
console.log('Strings: ', strings);
console.log('Object: ', obj);
// conditions
console.log('true || false: ', true || false);
console.log('true && false: ', true && false);
// default value on fly
var a = undefined;
var b = a || 80; // if no 'a', default here is 80
console.log(b);