I have a very basic jsfiddle. I am getting reference error for the function. I fail to understand the reason for the same. Here's the jsfiddle:
https://jsfiddle.net/akshaysuri/xxmq8e3m/
JavaScript:
function f1(){
var str = "aaa,bbb,ccc,ddd,eee,fff";
var strArr = str.split(",");
f2(strArr,strArr.length);
}
function f2(arr,len){
alert(len);
alert(arr);
}
HTML:
<body>
<button type="button" onclick="f1()">Click Me!</button>
</body>
The real problem I am facing in my application is that when I pass the array to f2, only first element is passed to f2 and not the entire array. I was trying to test it using a jsfiddle but first I need to get the reference error resolved.