This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var numbers = [50, 25, 40, 16, 29]; | |
var numOver30 = numbers.filter(function(value, index, array){ | |
return value > 30; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var numOver30 = numbers.filter(function(value){ | |
return value > 30; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var prntVal = ""; | |
var names = ['Frank', 'Charles', 'Dolly', 'Robert', 'Bob']; | |
names.forEach(function(value){ | |
prntVal = prntVal + 'Hello '+ value +"<br/>"; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nums = [10, 20, 30, 40, 50]; | |
var sum = nums.reduce(function(total, value){ | |
return total + value; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sum = nums.reduce(function(total, value, index, array){ | |
return total + value; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nums = [10, 20, 30, 40, 50]; | |
var sum = nums.reduceRight(function(total, value){ | |
return total + value; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nums = [10, 20, 30, 40, 50]; | |
var over30 = nums.some(function(value){ | |
return value > 30; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nums = [10, 20, 30, 40, 50]; | |
var Allover30 = nums.every(function(value){ | |
return value > 30; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nums = [10, 20, 30, 40, 50]; | |
var firstNum = nums.find(function(value){ | |
return value > 30 | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nums = [10, 20, 30, 40, 50]; | |
var findNumIndex = nums.findIndex(function(value){ | |
return value > 30 | |
}); |