foreach javascript

Code Example - foreach javascript

                
                        var items = ["item1", "item2", "item3"]
var copie = [];

items.forEach(function(item){
  copie.push(item);
});
                    
                
 

get out of foreach statement csharp

                        
                                foreach (string s in sList)
{
    if (s.equals("ok"))
    {
        break; // get out of the loop
    }
}
                            
                        
 

javascript foreach

                        
                                const avengers = ['thor', 'captain america', 'hulk'];
avengers.forEach((item, index)=>{
	console.log(index, item)
})
                            
                        
 

csharp foreach

                        
                                var numbers = new NumberList<int> { 0, 1, 2, 3, 4, 5 };
foreach (int num in numbers)
{
    DoSomething();
}
                            
                        
 

csharp foreach namevaluecollection

                        
                                NameValueCollection nv = HttpUtility.ParseQueryString(queryString);        
foreach (string key in nv) {
    var value = nv[key];

}
                            
                        
 

for each csharp

                        
                                foreach (int element in fibNumbers)
{
    Console.Write(%%%~COMPRESS~PRE~5~%%%quot;{element} ");
}