Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 07 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • May 10 2019 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 27 2019 19:46
    @mstellaluna banned @zhonghuacx
  • Apr 25 2019 17:12
    @mstellaluna banned @cmal
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:09
    thecodingaviator commented #31179
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:07
    thecodingaviator commented #31182
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator commented #31190
  • Apr 01 2019 18:05
    thecodingaviator commented #31157
  • Apr 01 2019 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 2019 18:04
    thecodingaviator closed #31157
  • Apr 01 2019 18:04
    thecodingaviator closed #33788
  • Apr 01 2019 18:04
    thecodingaviator commented #33788
WJ06
@WJ06
@Margaret2 okay tks :D
WJ06
@WJ06
var balance = 10500;
var cameraOn = true;
function steal(balance, amount) {
cameraOn = false;
if (amount < balance) {
balance = balance - amount;
}
return amount;
cameraOn = true;
}
var amount = steal(balance, 1200);
alert("Criminal: you stole " + amount + "!");
There are some
Falses in these lines of code, can someone help me to define it and explain pls ??!
May Kittens Devour Your Soul
@diomed
Margaret
@Margaret2
@WJ06 you can set a variable to be either true or false, that's called a Boolean value https://developer.mozilla.org/en-US/docs/Glossary/Boolean
in this case it's kind of a joke, it's like the robber is turning the camera on and off
@diomed 🤔
May Kittens Devour Your Soul
@diomed
@Margaret2 u can't say that it isn't
Margaret
@Margaret2
@diomed it isn't
May Kittens Devour Your Soul
@diomed
that woman is boss of IT department
she'd know
Margaret
@Margaret2
@diomed my grandma is boss of IT dept
i'll ask her :smiling_imp:
May Kittens Devour Your Soul
@diomed
oh wow!
how come u never mention your mum
Margaret
@Margaret2
what?
May Kittens Devour Your Soul
@diomed
nothing
never mind
madhuri soni
@sonimadhuri
@WJ06 cameraOn = true; will never be executed bacause you have put it after the return statement
Margaret
@Margaret2
ah that's also true lol
@sonimadhuri he said it's an example from a book
madhuri soni
@sonimadhuri
@Margaret2 maybe he had modified the example code
WJ06
@WJ06
@sonimadhuri okay, can u find out some more ?
May Kittens Devour Your Soul
@diomed
Margaret
@Margaret2
:joy: :joy: a policeman scared of a turtle :joy:
WJ06
@WJ06
@Margaret2 what do you mean by "turning camera on and off", i don't get it !!
In the book, it mentioned 2 errors, that are shadowed variable and something with 'amount'
Margaret
@Margaret2
@WJ06 when it says cameraOn = true;, you're supposed to imagine that the camera is on.
when it says cameraOn = false; you're supposed to imagine that the camera is off
it's like a yes or no question - Is the camera on? true means yes and false means no
madhuri soni
@sonimadhuri
@WJ06 balance is declared outside your function so it is global .you need not pass it to the function it can be used by the function directly
Margaret
@Margaret2
@sonimadhuri that's not good practice though, you should always be clear about what inputs your function has

@WJ06 but the errors are probably from what @sonimadhuri said above

cameraOn = true; will never be executed bacause you have put it after the return statement

madhuri soni
@sonimadhuri
@Margaret2 i suggested it because he mentioned about shadowed variable
Margaret
@Margaret2
@sonimadhuri didn't you suggest it before he mentioned a shadowed variable
madhuri soni
@sonimadhuri
no i dont think so
Margaret
@Margaret2
oh good grief, you said that at 11:04 CDT, he said "shadowed variable" at 11:11, 7 minutes later
Kyle Holm
@thekholm80
:popcorn:
Margaret
@Margaret2
lol i'm just annoyed :P
Kyle Holm
@thekholm80
i'm very upset that emoji does not exist
Margaret
@Margaret2
:corn: :dash: ?
:joy:
Kyle Holm
@thekholm80
:fire: :corn:
Margaret
@Margaret2
:o
WJ06
@WJ06
Why are you guys fighting on each other :worried: i'm just asking for help to seek out errors !!
Ene Catalin
@EneCatalin
because this is valhalla
only the strong survive here
Kyle Holm
@thekholm80
no, this is sparta
only 300 allowed in here
Margaret
@Margaret2
well, you need to be more clear about what you're asking, you said "there's falses in this code, explain" so I explained true and false, but it turns out you're looking for something completely different @WJ06
Sweet Coding :)
@SweetCodingInc
Ha!