workshopper / workshopper/javascripting

Scope Problem is Confusing

Open
#125 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
JavaScript
Stars
2.9k
Forks
1k
Avg merge
14h 47m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Scope problem introduction, code example, IIFE section, and challenge referenced in the issue. Clarify what calling foo() does, explain the relevant console.log behavior and the trailing )(); syntax, and consider whether the IIFE section belongs. Done means a JavaScript beginner can follow the example and understand the challenge instructions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.