Arrays, Functions & Callbacks:
Here is a quick recap of some fundamental JavaScript concepts I revised today:
1.Array Length (.length):
mark.length gives the total size (number of elements) in an array.
2.Mixed Data Types in Arrays:
JavaScript arrays can store different types of data together:
const ar = [10, 20, 30, "abc", true];
3.The .filter() Method:
numbers.filter(display)
numbers ➔ Array name
display ➔ Function passed inside .filter()
4.Callback Functions:
A callback function is a function passed as an argument to another function.
Example: filterdemo(display)
5.Arrow Functions (=>):
A concise way to write functions in JavaScript.
Top comments (1)
Array.length is not actually the same thing as the number of elements in the array.
Array.length Is NOT What You Think It Is