{"action":"created","comment":{"url":"https://api.github.com/repos/nodeschool-no/javascripting/pulls/comments/37952565","id":37952565,"diff_hunk":"@@ -0,0 +1,74 @@\n+---\n+\n+# SCOPE\n+\n+`Scope` er de variablene, objektene og funksjonene du har tilgang til.\n+\n+JavaScript har to scope: `global` og `lokal`. En variabel som er deklarert utenfor en funksjon er en `global` variabel. Dens verdi er tilgjengelig og kan endres gjennom hele programmet ditt. En variabel som er deklarert inni en funksjon er `lokal`. Den lages og fjernes hver gang funksjonen kjøres og variabelen kan ikke nås av kode som er utenfor funksjonen.\n+\n+Funksjoner som er definert inni andre funksjoner, kjent som nøstede funksjoner, har tilgang til scopet til den ytre funksjonen den er deklarert i.\n+\n+Følg nøye med på kommentarene i koden under:\n+\n+```js\n+var a = 4;  // a er en global variabel, den kan nås av funksjonene under\n+\n+function foo() {\n+    var b = a * 3;  // b kan ikke nås utenfor foo funksjonen, men kan nås av funksjoner\n+                    // definert inni foo\n+\n+    function bar(c) {\n+        var b = 2;  // enda en `b` variabel blir lagd i bar funksjonens scope\n+                    // endringer på den nye `b` variabelen endrer ikke den ytre `b` variabelen\n+        console.log( a, b, c );\n+    }\n+\n+    bar(b * 4);\n+}\n+\n+foo(); // 4, 2, 48\n+```\n+IIFE, Immediately Invoked Function Expression, er et pattern for å lage lokale scope","path":"problems/scope/problem_nb-no.md","position":31,"original_position":31,"commit_id":"0e07071519d097dd635d8aa11930915a7136edaa","original_commit_id":"0e07071519d097dd635d8aa11930915a7136edaa","user":{"login":"leftieFriele","id":177221,"avatar_url":"https://avatars.githubusercontent.com/u/177221?v=3","gravatar_id":"","url":"https://api.github.com/users/leftieFriele","html_url":"https://github.com/leftieFriele","followers_url":"https://api.github.com/users/leftieFriele/followers","following_url":"https://api.github.com/users/leftieFriele/following{/other_user}","gists_url":"https://api.github.com/users/leftieFriele/gists{/gist_id}","starred_url":"https://api.github.com/users/leftieFriele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leftieFriele/subscriptions","organizations_url":"https://api.github.com/users/leftieFriele/orgs","repos_url":"https://api.github.com/users/leftieFriele/repos","events_url":"https://api.github.com/users/leftieFriele/events{/privacy}","received_events_url":"https://api.github.com/users/leftieFriele/received_events","type":"User","site_admin":false},"body":":+1: ","created_at":"2015-08-26T07:21:09Z","updated_at":"2015-08-26T07:21:09Z","html_url":"https://github.com/nodeschool-no/javascripting/pull/8#discussion_r37952565","pull_request_url":"https://api.github.com/repos/nodeschool-no/javascripting/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/nodeschool-no/javascripting/pulls/comments/37952565"},"html":{"href":"https://github.com/nodeschool-no/javascripting/pull/8#discussion_r37952565"},"pull_request":{"href":"https://api.github.com/repos/nodeschool-no/javascripting/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/nodeschool-no/javascripting/pulls/8","id":43370731,"html_url":"https://github.com/nodeschool-no/javascripting/pull/8","diff_url":"https://github.com/nodeschool-no/javascripting/pull/8.diff","patch_url":"https://github.com/nodeschool-no/javascripting/pull/8.patch","issue_url":"https://api.github.com/repos/nodeschool-no/javascripting/issues/8","number":8,"state":"open","locked":false,"title":"Scope","user":{"login":"phillipj","id":1231635,"avatar_url":"https://avatars.githubusercontent.com/u/1231635?v=3","gravatar_id":"","url":"https://api.github.com/users/phillipj","html_url":"https://github.com/phillipj","followers_url":"https://api.github.com/users/phillipj/followers","following_url":"https://api.github.com/users/phillipj/following{/other_user}","gists_url":"https://api.github.com/users/phillipj/gists{/gist_id}","starred_url":"https://api.github.com/users/phillipj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phillipj/subscriptions","organizations_url":"https://api.github.com/users/phillipj/orgs","repos_url":"https://api.github.com/users/phillipj/repos","events_url":"https://api.github.com/users/phillipj/events{/privacy}","received_events_url":"https://api.github.com/users/phillipj/received_events","type":"User","site_admin":false},"body":"Closes nodeschool-no/oversettere#34","created_at":"2015-08-26T07:11:32Z","updated_at":"2015-08-26T07:21:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5848d059f9770376c1ba9c0caedeb1a47d7423d6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodeschool-no/javascripting/pulls/8/commits","review_comments_url":"https://api.github.com/repos/nodeschool-no/javascripting/pulls/8/comments","review_comment_url":"https://api.github.com/repos/nodeschool-no/javascripting/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodeschool-no/javascripting/issues/8/comments","statuses_url":"https://api.github.com/repos/nodeschool-no/javascripting/statuses/0e07071519d097dd635d8aa11930915a7136edaa","head":{"label":"nodeschool-no:scope","ref":"scope","sha":"0e07071519d097dd635d8aa11930915a7136edaa","user":{"login":"nodeschool-no","id":12680153,"avatar_url":"https://avatars.githubusercontent.com/u/12680153?v=3","gravatar_id":"","url":"https://api.github.com/users/nodeschool-no","html_url":"https://github.com/nodeschool-no","followers_url":"https://api.github.com/users/nodeschool-no/followers","following_url":"https://api.github.com/users/nodeschool-no/following{/other_user}","gists_url":"https://api.github.com/users/nodeschool-no/gists{/gist_id}","starred_url":"https://api.github.com/users/nodeschool-no/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodeschool-no/subscriptions","organizations_url":"https://api.github.com/users/nodeschool-no/orgs","repos_url":"https://api.github.com/users/nodeschool-no/repos","events_url":"https://api.github.com/users/nodeschool-no/events{/privacy}","received_events_url":"https://api.github.com/users/nodeschool-no/received_events","type":"Organization","site_admin":false},"repo":{"id":36885750,"name":"javascripting","full_name":"nodeschool-no/javascripting","owner":{"login":"nodeschool-no","id":12680153,"avatar_url":"https://avatars.githubusercontent.com/u/12680153?v=3","gravatar_id":"","url":"https://api.github.com/users/nodeschool-no","html_url":"https://github.com/nodeschool-no","followers_url":"https://api.github.com/users/nodeschool-no/followers","following_url":"https://api.github.com/users/nodeschool-no/following{/other_user}","gists_url":"https://api.github.com/users/nodeschool-no/gists{/gist_id}","starred_url":"https://api.github.com/users/nodeschool-no/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodeschool-no/subscriptions","organizations_url":"https://api.github.com/users/nodeschool-no/orgs","repos_url":"https://api.github.com/users/nodeschool-no/repos","events_url":"https://api.github.com/users/nodeschool-no/events{/privacy}","received_events_url":"https://api.github.com/users/nodeschool-no/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodeschool-no/javascripting","description":"Learn JavaScript by adventuring around in the terminal.","fork":true,"url":"https://api.github.com/repos/nodeschool-no/javascripting","forks_url":"https://api.github.com/repos/nodeschool-no/javascripting/forks","keys_url":"https://api.github.com/repos/nodeschool-no/javascripting/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodeschool-no/javascripting/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodeschool-no/javascripting/teams","hooks_url":"https://api.github.com/repos/nodeschool-no/javascripting/hooks","issue_events_url":"https://api.github.com/repos/nodeschool-no/javascripting/issues/events{/number}","events_url":"https://api.github.com/repos/nodeschool-no/javascripting/events","assignees_url":"https://api.github.com/repos/nodeschool-no/javascripting/assignees{/user}","branches_url":"https://api.github.com/repos/nodeschool-no/javascripting/branches{/branch}","tags_url":"https://api.github.com/repos/nodeschool-no/javascripting/tags","blobs_url":"https://api.github.com/repos/nodeschool-no/javascripting/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodeschool-no/javascripting/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodeschool-no/javascripting/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodeschool-no/javascripting/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodeschool-no/javascripting/statuses/{sha}","languages_url":"https://api.github.com/repos/nodeschool-no/javascripting/languages","stargazers_url":"https://api.github.com/repos/nodeschool-no/javascripting/stargazers","contributors_url":"https://api.github.com/repos/nodeschool-no/javascripting/contributors","subscribers_url":"https://api.github.com/repos/nodeschool-no/javascripting/subscribers","subscription_url":"https://api.github.com/repos/nodeschool-no/javascripting/subscription","commits_url":"https://api.github.com/repos/nodeschool-no/javascripting/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodeschool-no/javascripting/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodeschool-no/javascripting/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodeschool-no/javascripting/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodeschool-no/javascripting/contents/{+path}","compare_url":"https://api.github.com/repos/nodeschool-no/javascripting/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodeschool-no/javascripting/merges","archive_url":"https://api.github.com/repos/nodeschool-no/javascripting/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodeschool-no/javascripting/downloads","issues_url":"https://api.github.com/repos/nodeschool-no/javascripting/issues{/number}","pulls_url":"https://api.github.com/repos/nodeschool-no/javascripting/pulls{/number}","milestones_url":"https://api.github.com/repos/nodeschool-no/javascripting/milestones{/number}","notifications_url":"https://api.github.com/repos/nodeschool-no/javascripting/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodeschool-no/javascripting/labels{/name}","releases_url":"https://api.github.com/repos/nodeschool-no/javascripting/releases{/id}","created_at":"2015-06-04T17:37:50Z","updated_at":"2015-08-24T18:06:16Z","pushed_at":"2015-08-26T07:11:33Z","git_url":"git://github.com/nodeschool-no/javascripting.git","ssh_url":"git@github.com:nodeschool-no/javascripting.git","clone_url":"https://github.com/nodeschool-no/javascripting.git","svn_url":"https://github.com/nodeschool-no/javascripting","homepage":"http://nodeschool.io","size":1137,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"nodeschool-no:norwegian","ref":"norwegian","sha":"1281dd63295029cce6cf12764f13fbd277b193f3","user":{"login":"nodeschool-no","id":12680153,"avatar_url":"https://avatars.githubusercontent.com/u/12680153?v=3","gravatar_id":"","url":"https://api.github.com/users/nodeschool-no","html_url":"https://github.com/nodeschool-no","followers_url":"https://api.github.com/users/nodeschool-no/followers","following_url":"https://api.github.com/users/nodeschool-no/following{/other_user}","gists_url":"https://api.github.com/users/nodeschool-no/gists{/gist_id}","starred_url":"https://api.github.com/users/nodeschool-no/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodeschool-no/subscriptions","organizations_url":"https://api.github.com/users/nodeschool-no/orgs","repos_url":"https://api.github.com/users/nodeschool-no/repos","events_url":"https://api.github.com/users/nodeschool-no/events{/privacy}","received_events_url":"https://api.github.com/users/nodeschool-no/received_events","type":"Organization","site_admin":false},"repo":{"id":36885750,"name":"javascripting","full_name":"nodeschool-no/javascripting","owner":{"login":"nodeschool-no","id":12680153,"avatar_url":"https://avatars.githubusercontent.com/u/12680153?v=3","gravatar_id":"","url":"https://api.github.com/users/nodeschool-no","html_url":"https://github.com/nodeschool-no","followers_url":"https://api.github.com/users/nodeschool-no/followers","following_url":"https://api.github.com/users/nodeschool-no/following{/other_user}","gists_url":"https://api.github.com/users/nodeschool-no/gists{/gist_id}","starred_url":"https://api.github.com/users/nodeschool-no/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodeschool-no/subscriptions","organizations_url":"https://api.github.com/users/nodeschool-no/orgs","repos_url":"https://api.github.com/users/nodeschool-no/repos","events_url":"https://api.github.com/users/nodeschool-no/events{/privacy}","received_events_url":"https://api.github.com/users/nodeschool-no/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodeschool-no/javascripting","description":"Learn JavaScript by adventuring around in the terminal.","fork":true,"url":"https://api.github.com/repos/nodeschool-no/javascripting","forks_url":"https://api.github.com/repos/nodeschool-no/javascripting/forks","keys_url":"https://api.github.com/repos/nodeschool-no/javascripting/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodeschool-no/javascripting/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodeschool-no/javascripting/teams","hooks_url":"https://api.github.com/repos/nodeschool-no/javascripting/hooks","issue_events_url":"https://api.github.com/repos/nodeschool-no/javascripting/issues/events{/number}","events_url":"https://api.github.com/repos/nodeschool-no/javascripting/events","assignees_url":"https://api.github.com/repos/nodeschool-no/javascripting/assignees{/user}","branches_url":"https://api.github.com/repos/nodeschool-no/javascripting/branches{/branch}","tags_url":"https://api.github.com/repos/nodeschool-no/javascripting/tags","blobs_url":"https://api.github.com/repos/nodeschool-no/javascripting/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodeschool-no/javascripting/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodeschool-no/javascripting/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodeschool-no/javascripting/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodeschool-no/javascripting/statuses/{sha}","languages_url":"https://api.github.com/repos/nodeschool-no/javascripting/languages","stargazers_url":"https://api.github.com/repos/nodeschool-no/javascripting/stargazers","contributors_url":"https://api.github.com/repos/nodeschool-no/javascripting/contributors","subscribers_url":"https://api.github.com/repos/nodeschool-no/javascripting/subscribers","subscription_url":"https://api.github.com/repos/nodeschool-no/javascripting/subscription","commits_url":"https://api.github.com/repos/nodeschool-no/javascripting/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodeschool-no/javascripting/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodeschool-no/javascripting/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodeschool-no/javascripting/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodeschool-no/javascripting/contents/{+path}","compare_url":"https://api.github.com/repos/nodeschool-no/javascripting/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodeschool-no/javascripting/merges","archive_url":"https://api.github.com/repos/nodeschool-no/javascripting/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodeschool-no/javascripting/downloads","issues_url":"https://api.github.com/repos/nodeschool-no/javascripting/issues{/number}","pulls_url":"https://api.github.com/repos/nodeschool-no/javascripting/pulls{/number}","milestones_url":"https://api.github.com/repos/nodeschool-no/javascripting/milestones{/number}","notifications_url":"https://api.github.com/repos/nodeschool-no/javascripting/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodeschool-no/javascripting/labels{/name}","releases_url":"https://api.github.com/repos/nodeschool-no/javascripting/releases{/id}","created_at":"2015-06-04T17:37:50Z","updated_at":"2015-08-24T18:06:16Z","pushed_at":"2015-08-26T07:11:33Z","git_url":"git://github.com/nodeschool-no/javascripting.git","ssh_url":"git@github.com:nodeschool-no/javascripting.git","clone_url":"https://github.com/nodeschool-no/javascripting.git","svn_url":"https://github.com/nodeschool-no/javascripting","homepage":"http://nodeschool.io","size":1137,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodeschool-no/javascripting/pulls/8"},"html":{"href":"https://github.com/nodeschool-no/javascripting/pull/8"},"issue":{"href":"https://api.github.com/repos/nodeschool-no/javascripting/issues/8"},"comments":{"href":"https://api.github.com/repos/nodeschool-no/javascripting/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/nodeschool-no/javascripting/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/nodeschool-no/javascripting/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodeschool-no/javascripting/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/nodeschool-no/javascripting/statuses/0e07071519d097dd635d8aa11930915a7136edaa"}}}}