Why does objA.myf3.apply(this,a); only console.log the first index in the array a
how am I using apply wrong i'm expecting myf3:function(myarr) to be called for each index in the array
and am expecting it to log 1 2 3 4 ......
Thanks for the help.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
var objA = {
myf3:function(myarr){
console.log(myarr); // why does only the first index of the array come through?
}
};
var objB = {
myfb2:function(){
var a = [1,2,3,4,5,6,7,8,9];
objA.myf3.apply(this,a);
}
};
objB.myfb2();
</script>
</head>
<body>
test apply?????
</body>