d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Can Someone Explain This To Me Please > Js
Add Reply New Topic New Poll
Member
Posts: 16,404
Joined: Mar 28 2009
Gold: 7.69
Jul 8 2015 06:09pm


here are the things im confused about:

1. On line 1, why does the () remain empty?

2. On line 5, setting getToDaChoppa to false is what prevents the infinite loop?

3. On lines 8 and 10 I simply do not understand what purpose those lines of code serve
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jul 8 2015 06:37pm
line 1: functions accept parameters, do something, and optionally return a result. in this example, no parameters are needed.
line 5: yes. it will repeat the action until the while condition is false
line 10: comment out the line and run your code. see what happens. lines 1 through 9 simply define the function. it will not actually get executed. line 10 is what executes it.
Member
Posts: 16,404
Joined: Mar 28 2009
Gold: 7.69
Jul 8 2015 06:52pm
Quote (carteblanche @ Jul 8 2015 07:37pm)
line 1: functions accept parameters, do something, and optionally return a result. in this example, no parameters are needed.
line 5: yes. it will repeat the action until the while condition is false
line 10: comment out the line and run your code. see what happens. lines 1 through 9 simply define the function. it will not actually get executed. line 10 is what executes it.


i edited out line 10 and the code still passed except line 4 wasnt executed onto the console. ok i understand your explanations ty
Member
Posts: 5,167
Joined: Nov 23 2006
Gold: 11.01
Jul 9 2015 11:57am
I don't see a link to code or anything :'(
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jul 12 2015 07:29pm
if it makes you feel any better, i'm going through code academy with a friend now for JS.

your question #3 was answered in "Introduction to Functions" 2/18

This post was edited by carteblanche on Jul 12 2015 07:33pm
Member
Posts: 16,404
Joined: Mar 28 2009
Gold: 7.69
Jul 12 2015 09:55pm
Quote (carteblanche @ Jul 12 2015 08:29pm)
if it makes you feel any better, i'm going through code academy with a friend now for JS.

your question #3 was answered in "Introduction to Functions" 2/18


O_o ill take a look
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll