You are enough
The media focuses on being the best and constantly highlights people who are the best. This can cause feelings and thoughts like 'If I am not going to be the best, what is the point?'
What if we applied this to cooking? What if everyone who cooks just stopped cooking because they were not the best and they believed only the best people should cook? Our world would be a much sadder and emptier place.
You don't have to be the best to make substantial positive contributions. You do have to strive to be good, thoughtful, and willing to learn from your mistakes. This will create a valuable contributor to whatever you work on and a welcome member of any team.
- What is the first index position of an array?
- What is a primitive data type?
- Is an array a primitive data type?
- What is the difference between:
for (let i = 0; i < 5; i++)
for (i = 0; i < 5; i++)
Without using the .indexOf
array method, write your own findIndex
function.
The function should take an array and the string or number to be found.
If the item is found, it should return the index position. If no matching item is found, it should return -1. If multiple matches exist, only the first index positions should be replaced.
For example with the following array: findIndex(letters, 'a')
should return 0. findIndex(letters, 2)
should return -1.
const letters = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
"a",
];
Practice array methods with callbacks
Make a function that takes one argument, a two-dimensional array, where all the arrays are the same length, and returns the greatest sum of the numbers by row and column.
const arr = [
[10, 20, 30],
[40, 50, 60],
[70, -80, 90],
];
greatestSum(arr); //180
Bonus - test for diagonal as well
The same as finding the index. However, if there is more than one match, return an array of matching index positions.