hi, i have read some files on object oriented js... i have one question if there is no class then how all object works? it was written that it is prototype based oop concept which i didnt quite understand... can anyone explain me.....
4 replies to this topic
#1
Posted 03 January 2012 - 09:19 PM
|
|
|
#2
Posted 05 January 2012 - 06:52 AM
Objects in javascript are declared as functions. These "object" functions can then be instantiated with the 'new' operator.
Example:
Example:
function myobject(parameter) {
this.x = parameter;
}
var foo = new myobject(5);
document.write(foo.x); // writes '5'
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid
#3
Posted 05 January 2012 - 08:39 AM
I just found this article interesting:
Object-Oriented Javascript - Nefarious Designs
It seems javascript can handle all the important aspects of an OO language.
Object-Oriented Javascript - Nefarious Designs
It seems javascript can handle all the important aspects of an OO language.
#4
Posted 05 January 2012 - 03:27 PM
Technically, JavaScript is a prototype language, which means you create objects from other objects, then add methods to them as needed.
#5
Posted 05 January 2012 - 10:08 PM
thanks to every one..... i have reading a lot of stuff on this topic...n also started some practical work on it.... i got the basic fundamentals about OOJS....
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









