Skip to content

Here is the lab #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Untitled-1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// we covered .map .filter and foreach
//const forEacReturnValue= arrayOfFellowws.forEach( eachFel +> console.log(" check" + eachFel.name))

const checkFellowName = (eachFel) => {
console.log(" check" + eachFel.name)
}

//console.log(checkFellowName)
//arraoOfFellows.forEach(checkFellowName)


// arrayofFellows.forEach( checkFellowName )
//arrayOfFellows.forEach(checkFellowName())
arrayOfFellows.forEach( () => checkFellowName () )

// structure an anonymous function and use it in a dynamic way .
//filtering process on an array of objects

const arrayOfFellows = [
{name: "PersonA"},
{name: "PersonAB"},
{name: "PersonABC"},
{name: "PersonABCD"},
{name: "PersonABCDE"}
]
const FilteredArrayOfFellow = []

for(const eachFell of arrayOfFellows) {
if(eachFell.name.length> 5){
FilteredArrayOfFellow.push(eachFell)
}
}
console.log(FilteredArrayOfFellow)
28 changes: 27 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,33 @@
* Depending on the operation, either add up all of the numbers or subtract all of the numbers, from left to right.
* @returns {number} The result of either adding all numbers or subtracting all numbers, depending on the arguments added to the command line.
*/
function calculator() {}
function calculator( ) {
const thisACalc = (something,a,b,c) =>{
const calculator = something(a,b,c);
console.log(add);
};

if(something === "plus") {
const plus = (a,b,c) => {
return a + b + c;
};

} else if (something === "minus") {
const minus = (a,b,c) => {
return a - b - c;
};

}else if (something === "divide") {
return "Invalid operation: diivide";
};

}else if (something === " ") {
return "No numbers provided";
};
if (something !== "something") {
return " No operation provided";
};


// Don't change anything below this line.
module.exports = calculator;
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,5 @@ node index.js
## Tips

- Remember that the first and second elements of `process.argv` are always the path to the `node` program and the filepath.
- Remember that each argument from the command line will be read in as a string. You will need some way to convert the inputs from strings to numbers.
- Remember that each argument from the command line will be read in as a string. You will need some way to con10vert the inputs from strings to numbers.
- Because you don't know how many numbers will be passed in, you may need to _iterate_ over the numbers.