Click here to Skip to main content
15,884,876 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
JavaScript
function ForEach(array, action)
    {
       for (var i=0; i< array.length;i++)
       {
           action(array[i]);
       }

    }
    ForEach(["Ahmed","Aqib","Hashir","Mahi"],print);

here print screen appearing in browser but the array content is not showing on browser but print screen appearing? why
and m also try below code and it shows me the error illegal invocation
JavaScript
function ForEach(array, action)
    {
       for (var i=0; i< array.length;i++)
       {
           action(array[i]);
       }

    }
    var pp=document.write;
    ForEach(["Ahmed","Aqib","Hashir","Mahi"],pp);
Posted
Updated 9-Jan-14 23:16pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900