04-22-2009, 02:11 PM
|
#8 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
Quote:
Now that looks even more like PHP....or should say, PHP looks more like JS...
|
Well, most languages these days have syntax that look similar to C, including PHP. However with Javascript there are a few things that differ to PHP (well in the current version of PHP in any case) like closures, lambda functions,o bject literals etc
javascript Code:
obj = { var : 'test', print: function() { alert(this.var); } }; obj.print();
javascript Code:
var obj = function () { function doAlert(str) { alert(str); } return { var : 'test', print : function() { doAlert(this.var); } }; }(); obj.print();
javascript Code:
obj = function(){alert('Self invoked!'); }();
javascript Code:
getName = function(){ namesArray = ['sam', 'ben', 'john','dave']; return function(n){ return namesArray[n]; }; }(); alert(getName(2));
Quote:
|
But I would not spend to much time with the basic javascript and would jump right into a framework such as jquery.
|
Can't say I agree, I think a good understanding of how the language works (and ultimately how the framework works) is essential for performance if nothing else.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|