You are looking at posts that were written on August 22nd, 2010.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jul | Sep » | |||||
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 | |||||
Posted on August 22nd, 2010 by thiswayup.
Categories: dev.
As I've started to learn more about javascript this year , I've been really enjoy digesting some interesting resources on the internet to learn more about the innards that make this rather great lanaguage. One that I have found is a great google tech talk and he highlighted a rather quiky thing in javascript.
function good(){
return true
}
alert( good() );
//alert is true
function bad(){
return
true
}
alert( bad() );
//alert is "undefined";
One would think that if you run both function you would get the same return (ie true) but there's one thing I learnt from Doug's talk is that Javascript was built with a interesting quirk, if it runs into a compilation error, it actually backs up and puts in a semi colon in for you! This was originally designed to help people first picking up the language but as a consequence has caused this weird business. So the moral is to always add semi colons.