Created
March 29, 2012 14:46
-
-
Save h4/2238109 to your computer and use it in GitHub Desktop.
JS. Объект Fuction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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