workshopper / workshopper/javascripting

Scope Problem is Confusing

Offen
#125 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

discussion
Vorherrschende Sprache
JavaScript
Sterne
2.9k
Forks
1k
Ø Merge
14 Std. 47 Min.
Gemergte PRs (30 T.)
1

Beschreibung

As someone who has no previous JavaScript knowledge, the Scope problem is quite frustrating. Even though the introduction does a good job defining scope, I was not prepared to follow the code example.

Comments need to be added next to console.log to indicate that when we pass the argument within bar back to the function, var b = 2 will be ignored. I'm sure I haven't phrased that well, but it's a starting point.

Also, what purpose does the line foo(); // 4, 2, 48 serve? I understand that foo is the function's name, and the comments next to it are the values of these variables, but this statement is just sitting there. We need context. What would including foo(); at the end of this program do when we run it?

I also don't believe the IIFE section adds any relevant information to this problem. It is distracting.

Now moving on to the challenge, I don't understand why there is )(); after every closing }. I suppose that ties back to the foo(); in the example code, but I don't understand its usage.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Einführung in das Scope-Problem, dem Codebeispiel, dem IIFE-Abschnitt und der in der Issue referenzierten Herausforderung. Stelle klar, was der Aufruf von foo() bewirkt, erkläre das relevante Verhalten von console.log und die abschließende Syntax )(); und prüfe, ob der IIFE-Abschnitt dazugehört. Als erledigt gilt die Aufgabe, wenn ein JavaScript-Anfänger dem Beispiel folgen und die Anweisungen zur Herausforderung verstehen kann.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.