Skip to content
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

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

Uebungen #3

wants to merge 29 commits into from

Conversation

cm-clodos
Copy link

flowControll + fibonacci üebungen gemacht
flowControll bei quersummen übung habe ich probleme die zahlen die > 9 sind zu zerlegen und addieren.... deshalb noch ausgelassen

@cm-clodos
Copy link
Author

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

@ideadapt
Copy link
Contributor

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.

@ideadapt
Copy link
Contributor

Dein neues findAll macht aber immer noch nicht das was es soll (weder gemäss Aufgabenstellung noch gemäss Array.prototype.filter) :)

@cm-clodos
Copy link
Author

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>)
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stimmt diese Ausgabe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants