ZendCon 2010 – JavaScript for (real) beginners

Warning: this is not a real post…
It is more ‘some notes’ I’ve took in one of the morning sessions in ZendCon 2010

* In php associative array are very powerful – in Java script the keys will be integer.
You can have the same ‘associative’ if you build your own object that contain the features.

var obj1 = new Object();
obj1['foo'] = 'momo';
obj1.foo2 = 'bobo';

var obj2 = {
‘foo’ : ‘bar’,
‘confObj’ : ‘bla-bla’

* Nice way to use array {key1: “value”};
* The ‘this‘ keyword – what it point to now? A good question with more then one answer.
* ‘new‘ – create a copy from the function/obj and assign it.
* instanceOf – are X is instance from Y? (return as string)
* typeOf – lots of return options.



both as objects and as contractor or procedural

as Procedural

function ff(str) {
console.log('ff is:' + str);

as an Object

var foo2 = function(str){
this.str = str;
this.say = function(){
console.log('inside say let see what is str:'+str);

prototype – a way to let you inheritance
* jQuery (Mr. Rasig) show a nice way to do a way of ‘class’ / obj and standard inheritance.
For example:

var Robot = function(name){ = name;
this.say = function(){
console.log("bla bla my name " + );
myRob = new Robot("momo");
// refine say
myRob.say = function() {
console.log("Yo - my name " + );

// lets add to the ‘class’ definition a new function – it will be in all the obj. we created from it
Robot.prototype.showDown() = function(str) {
console.log (‘bye bye ‘ + str);

Useful sites/resource to keep learning the core of JS (and not just some ‘cool’ animation):
** mozilla – core and ref

* JavaScript: The Definitive Guide – David Flanagan
* JavaScript: The Good parts – Doulas crockford
* JavaScript Patterns – Stoyan Steganov
* High-Performance JavaScript – Nicholas C. Zakas

On twitter you can find more #zc10 or #zendcon


One thought on “ZendCon 2010 – JavaScript for (real) beginners

  1. Pingback: Anis Berejeb » ZendCon 2010 : Streaming et Slides

Leave a Reply

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

You are commenting using your 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