difference between c# and unity code example
Example 1: difference between foreach and map in js
forEach() just loop through the elements. It's throws away return values and always returns undefined.The result of this method does not give us an output .
map() loop through the elements allocates memory and stores return values by iterating main array
Example:
var numbers = [2,3,5,7];
var forEachNum = numbers.forEach(function(number){
return number
})
console.log(forEachNum)
var mapNum = numbers.map(function(number){
return number
})
console.log(mapNum)
map() is faster than forEach()
Example 2: difference between java and javascript
java is virtualised and compiled while javascript isn't.
javascript and java aren't that similar apart from beign
both OOP.