-
Notifications
You must be signed in to change notification settings - Fork 13
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
Uebungen #3
base: master
Are you sure you want to change the base?
Uebungen #3
Conversation
# Conflicts: # src/exercises/functions/closures.js # src/exercises/functions/fn-objects-callbacks.js # src/functions.js # src/oop-es5.js
findAll() Aufgabe stellung nicht ganz verstanden wie es sein sollte. Meine Lösung filter() gibt array zurück mit matches wenn array.length > 0 dann boolean true zurück |
Die Idee war, dass du in findAll (selbst) das machst, was Array.prototype.filter macht. |
Dein neues findAll macht aber immer noch nicht das was es soll (weder gemäss Aufgabenstellung noch gemäss Array.prototype.filter) :) |
Haha muss dich ja beschäftigen ;) hoffe jetzt passts |
console.log(arr.reduce((sum, val ) => { | ||
return sum + val | ||
}),0) | ||
//Signatur: reduce(in: Array<Number>, predicate: sum:Number, val:Number : Array<Number>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ein prädikat retourniert immer ein boolean. bzw. es fehlt allgemein der teil, der besagt dass der parameter predicate eine funktion ist.
predicate: (Object) => Boolean
wäre so die allgemein Variante würde ich sagen.
Bei reduce ist es aber ja kein Prädikat, sondern einfach eine Funktion mit zwei Inputs und einem Output.
}) | ||
console.log(oneDigit) | ||
quersum = oneDigit.reduce((sum, val) => sum += val) | ||
console.log(quersum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stimmt diese Ausgabe?
flowControll + fibonacci üebungen gemacht
flowControll bei quersummen übung habe ich probleme die zahlen die > 9 sind zu zerlegen und addieren.... deshalb noch ausgelassen