{"action":"created","issue":{"url":"https://api.github.com/repos/nodeschool/discussions/issues/400","repository_url":"https://api.github.com/repos/nodeschool/discussions","labels_url":"https://api.github.com/repos/nodeschool/discussions/issues/400/labels{/name}","comments_url":"https://api.github.com/repos/nodeschool/discussions/issues/400/comments","events_url":"https://api.github.com/repos/nodeschool/discussions/issues/400/events","html_url":"https://github.com/nodeschool/discussions/issues/400","id":37743454,"number":400,"title":"stuck on baby steps :( *SOLVED* CONTAINS SPOILERS","user":{"login":"basiclaser","id":3663537,"avatar_url":"https://avatars1.githubusercontent.com/u/3663537?v=4","gravatar_id":"","url":"https://api.github.com/users/basiclaser","html_url":"https://github.com/basiclaser","followers_url":"https://api.github.com/users/basiclaser/followers","following_url":"https://api.github.com/users/basiclaser/following{/other_user}","gists_url":"https://api.github.com/users/basiclaser/gists{/gist_id}","starred_url":"https://api.github.com/users/basiclaser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basiclaser/subscriptions","organizations_url":"https://api.github.com/users/basiclaser/orgs","repos_url":"https://api.github.com/users/basiclaser/repos","events_url":"https://api.github.com/users/basiclaser/events{/privacy}","received_events_url":"https://api.github.com/users/basiclaser/received_events","type":"User","site_admin":false},"labels":[{"id":66549491,"url":"https://api.github.com/repos/nodeschool/discussions/labels/learnyounode","name":"learnyounode","color":"F0A028","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2014-07-13T15:31:40Z","updated_at":"2018-02-02T08:25:00Z","closed_at":"2014-08-08T09:25:29Z","author_association":"NONE","body":"Hey guys, \nI'm trying to iterate through the third parameter of process.argv\n\nthis is my code so far : \n///////////////////\nvar stringValue = 1;\n\nfor(i=0;i<10;i++){\nstringValue+= Number(process.argv[2[i]]);\n}\nconsole.log(stringValue);\n//////////////////\n\nnot sure where to go from here, I have made multiple attempts to get number an array of numbers from the string of the third parameter, but I either just get the first number before spaces, or NaN\n\nCould someone provide me with a tutorial or explanation? Is it something relating to types?\n\nI also read through the nodeJS docs http://nodejs.org/api/process.html#process_process_argv\n\nand managed to run their example, but I don't know why my attempt didn't work and theirs did. \n\nThanks\n"},"comment":{"url":"https://api.github.com/repos/nodeschool/discussions/issues/comments/362518218","html_url":"https://github.com/nodeschool/discussions/issues/400#issuecomment-362518218","issue_url":"https://api.github.com/repos/nodeschool/discussions/issues/400","id":362518218,"user":{"login":"MDgo31","id":20636447,"avatar_url":"https://avatars3.githubusercontent.com/u/20636447?v=4","gravatar_id":"","url":"https://api.github.com/users/MDgo31","html_url":"https://github.com/MDgo31","followers_url":"https://api.github.com/users/MDgo31/followers","following_url":"https://api.github.com/users/MDgo31/following{/other_user}","gists_url":"https://api.github.com/users/MDgo31/gists{/gist_id}","starred_url":"https://api.github.com/users/MDgo31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MDgo31/subscriptions","organizations_url":"https://api.github.com/users/MDgo31/orgs","repos_url":"https://api.github.com/users/MDgo31/repos","events_url":"https://api.github.com/users/MDgo31/events{/privacy}","received_events_url":"https://api.github.com/users/MDgo31/received_events","type":"User","site_admin":false},"created_at":"2018-02-02T08:25:00Z","updated_at":"2018-02-02T08:25:00Z","author_association":"NONE","body":"I think the wording of the challenge is very wrong. When I read below description, first thing I understand is , some numbers should be provided and my program is required to convert them numbers ,then add them to a total..  \r\n\r\nHowever  it was not the case , we are required to write an algorithm which will read numbers as whole and convert them into a number which is very different then summing... \r\n\r\n\"  Write a program that accepts one or more numbers as command-line arguments  \r\n  and prints the sum of those numbers to the console (stdout)\"  \r\n\r\nSo I used below algorithm:\r\n//I first created a variable to contain total sum\r\nvar total=0;\r\n//I have created an array for numbers which will be converted from process.arg[2]\r\nvar nums=[]\r\n//I run a for loop so I can convert every 'char' to number then add them into my number array.\r\nfor (var i = 0; i < process.argv[2].length; i++)\r\n{\r\n//As you typed node program.js 1234 ,  1234 will be second argument however it is string and in order to split into separate chars I have to use [i].\r\n nums[i]=Number(process.argv[2][i]);\r\n total=total+nums[i];\r\n}\r\nconsole.log(total); \r\n"}}
{"actor":{"display_login":"MDgo31"}}