Skip to content

Instantly share code, notes, and snippets.

@h4
Created March 29, 2012 14:46
Show Gist options
  • Save h4/2238109 to your computer and use it in GitHub Desktop.
Save h4/2238109 to your computer and use it in GitHub Desktop.
JS. Объект Fuction
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++)
this[i] = initArray.arguments[i];
}
var myFriends = new initArray("Михаил", "Максим", "Сергей", "Леонид");
alert(myFriends.length);
alert(myFriends[0]);
var o1 = {
testvar: 'testvar первого объекта',
fun1: function() {
alert('свойство объекта o1: ' + this.testvar);
}
};
var o2 = {
testvar: 'testvar второго объекта',
fun2:function() {
alert('свойство объекта o2: ' + this.testvar);
}
};
o1.fun1.call(o2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment