+ 1

How do you create a function that is attatched to an object like in the example document.write();

21st Sep 2016, 4:24 PM
Garett Espinoza
2 ответов
0
Ver obj; Obj.func = function() {}
21st Sep 2016, 11:26 PM
Ambriel
0
1. var obj = {}; obj.func = function() {} 2. function Fruits(){} Fruits.prototype.getFruitsA = function(){} var fruits = new Fruits(); fruits.getFruitsB = function(){} getFruitsA(); getFruitsB();
22nd Sep 2016, 7:59 AM
yazhe wang
yazhe wang - avatar