_foreach()

110

_foreach() -

Example 1
// Requiring the lodash library  
const _ = require("lodash");  
  
// Use of _.forEach() method 
_.forEach(['c', 'cpp', 'java','python'], function(value) {
  console.log(value);
});

//output
'c'
'cpp'
'java'
'python'
['c', 'cpp', 'java','python']

========================================================================================
Example 2
 // Requiring the lodash library  
const _ = require("lodash");  
  
// Use of _.forEach() method 
_.forEach(['c', 'cpp', 'java','python'], function(value) {
  console.log(value);
});

//output
'x'
'y'
{ 'x': 1, 'y': 2 }

Comments

Submit
0 Comments