These are chat archives for FreeCodeCamp/HelpJavaScript

18th
Aug 2018
Christopher McCormack
@cmccormack
Aug 18 2018 00:04
Later all :wave:
Brad
@bradtaniguchi
Aug 18 2018 00:09
I'll be here... fighting the great docker whale!
Christopher McCormack
@cmccormack
Aug 18 2018 00:11
there's some clever jokes to be made there...
Missli
@LHZ1997
Aug 18 2018 01:03
hello
help
Return Early Pattern for Functions
谁能帮帮我
Who can help me?
Brad
@bradtaniguchi
Aug 18 2018 01:14
Hell yea it works! Time to enjoy my weekend XD
Simon Cordova
@gbsimon87
Aug 18 2018 01:21
great job @bradtaniguchi
I hope I can say the same soon!
Eric Wang
@bigbigDreamer
Aug 18 2018 07:23
After adopting HTTP -proxy-middleware reverse server, the front react sends ajax requests, and express is used as the background framework, how to get the data source transmitted from the front desk.
who can help me?
Damien Doumer
@DamienDoumer
Aug 18 2018 10:54
Hi everyone, check this blog post about Building An Offline Web App : Offline Currency Converter https://doumer.me/offline-web-app-currency-converter/
Mrsmao
@whb123
Aug 18 2018 13:09
Want to see how the 224 code is implemented, who would like to share it?
Pagnito
@Pagnito
Aug 18 2018 16:57
GODAMN TYPOS!!!!!!
wasting god blessssed time
Christopher McCormack
@cmccormack
Aug 18 2018 16:58
fear-leads-to-anger-anger-leads-to-hate-leads-to-suffering-yoda.jpg
@Pagnito
Pagnito
@Pagnito
Aug 18 2018 16:58
@Pagnito lmao
yes master
i shall go work on my zen
Christopher McCormack
@cmccormack
Aug 18 2018 17:02
need a yinyang emoji
☯️
宋少卿
@songshaoqing
Aug 18 2018 19:34
Who can help me?
JJ Megma
@megma_jj_twitter
Aug 18 2018 19:35
@songshaoqing Whats up?
宋少卿
@songshaoqing
Aug 18 2018 19:36
卡牌序列 2, J, 9, 2, 7 应该返回 "1 Bet"
JJ Megma
@megma_jj_twitter
Aug 18 2018 19:36
@songshaoqing I don't know that language, I speak english
Sorry
宋少卿
@songshaoqing
Aug 18 2018 19:37
oh i'm sorry

switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
return count+" "+ "Bet";
//;
case 7:
case 8:
case 9:
return count+" "+ "Hold";
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
return count+" "+ "Hold";
//;

}

Counting Cards
why no right?
JJ Megma
@megma_jj_twitter
Aug 18 2018 19:39
@songshaoqing That isn't how a switch works
switch(expression) {
    case x:
        code block
        break;
    case y:
        code block
        break;
    default:
        code block
}
@songshaoqing
  case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      count++;
      break;
宋少卿
@songshaoqing
Aug 18 2018 19:43
thank you!I try to try;
JJ Megma
@megma_jj_twitter
Aug 18 2018 19:44
ok
宋少卿
@songshaoqing
Aug 18 2018 19:45
But he needs to return.
"5 Bet"
"-1 Hold"
JJ Megma
@megma_jj_twitter
Aug 18 2018 19:48
@songshaoqing You don't want to return in ur switch
When you return you are not letting the function finish once it gets that case
So you just want to update the global variable count based on the case
then after the switch has ran, you want to check the count and return that count plus the string bet or hold depending
宋少卿
@songshaoqing
Aug 18 2018 19:53
This example can be solved by using switch?
JJ Megma
@megma_jj_twitter
Aug 18 2018 19:53
absolutely
look at the short example i posted
case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      count++;
      break;
now finish it
@songshaoqing Maybe you should do it with if else first?
宋少卿
@songshaoqing
Aug 18 2018 19:55
I know, but not right...
JJ Megma
@megma_jj_twitter
Aug 18 2018 19:55
lemme see ur code
what u have changed
@songshaoqing Let me see your changes
宋少卿
@songshaoqing
Aug 18 2018 19:58
OK
function cc(card) {
// 请把你的代码写在这条注释以下
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
return count+" "+"Bet";
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
return count+" "+"Hold";
break;
default:
return count+" "+"Hold";
}
JJ Megma
@megma_jj_twitter
Aug 18 2018 20:05
@songshaoqing You are still returning inside the switch statement
@songshaoqing remove those returns, then do a check on count and return outside the switch based on that
宋少卿
@songshaoqing
Aug 18 2018 20:06
I understand,,
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
break;
}
if(count>0){
return count+" "+"Bet";
}
else
{
return count+" "+"Hold";
}
@megma_jj_twitter Thank you, my distant friend.
Ozarion
@Ozarion
Aug 18 2018 20:56
Hey Everyone. How's the weekend going? Just got the API's and Microservices certificate \(~o~)/
宋少卿
@songshaoqing
Aug 18 2018 20:57
I have just begun.
haha
@Ozarion How many questions have you brushed?
Philip Durbin
@pdurbin
Aug 18 2018 20:59
congrats
Ozarion
@Ozarion
Aug 18 2018 21:00
@pdurbin Thanks mate. :)
@songshaoqing Well, Not many actually, Since most of the concepts and stuff you'll learn will be used in later exercises, You can't really brush anything, specially in Javascript section.
宋少卿
@songshaoqing
Aug 18 2018 21:02
I feel that I am learning slowly.(^..^)/
Ozarion
@Ozarion
Aug 18 2018 21:04
@songshaoqing Even though I don't know at what pace you are going. I'm sure that won't be the case. Just keep getting back at it, learn a chunk at a time, absorb it, then comeback and learn a little more. Once you get into the habit, It only becomes better.
宋少卿
@songshaoqing
Aug 18 2018 21:05
yep
Understanding is the most important.
Ozarion
@Ozarion
Aug 18 2018 21:08
master the the fundamentals. For example do everything in all of CSS and JS sections and get everything straight no matter how much time it takes. But surely If you are in a hurry or are not a fan of particular framework, You can safely skip that for the time. ;)
Philip Durbin
@pdurbin
Aug 18 2018 21:11
Is CSS Grid one of the fundamentals?
JJ Megma
@megma_jj_twitter
Aug 18 2018 21:11
@songshaoqing NP
宋少卿
@songshaoqing
Aug 18 2018 21:13
@megma_jj_twitter thank you ^_^
Ozarion
@Ozarion
Aug 18 2018 21:13
@pdurbin Now. I think It is. What's your though on it?
Philip Durbin
@pdurbin
Aug 18 2018 21:14
I've been watching CSS Grid videos by Jen Simmons. Seems like good stuff.
宋少卿
@songshaoqing
Aug 18 2018 21:16
I'm learning Vue. I don't know which framework is better.
It's hard to feel Reack.
Ozarion
@Ozarion
Aug 18 2018 21:21
@pdurbin Cool. FCC also does a pretty good job of explaining grid. Since I've learned to use CSS Grid, My Html has gotten so much cleaner.
Philip Durbin
@pdurbin
Aug 18 2018 21:23
Nice. I've been waiting for something like Grid to come along.
But I haven't really used it. Yet. I also have a book by Rachel Andrew about it.
Ozarion
@Ozarion
Aug 18 2018 21:26
Hahah! I can relate. I also buy books about new tech to read on weekends.
Philip Durbin
@pdurbin
Aug 18 2018 21:28
The book I have is mercifully thin. :)
Ozarion
@Ozarion
Aug 18 2018 21:29
But most of the time, it's working on projects and reading dry documentations that really gets me to learn most of the new things.BTW CSS Grid is pretty damn simple after you actually apply it once or twice.
Philip Durbin
@pdurbin
Aug 18 2018 21:34
Sure. I like it when projects encourage me to learn new things. I got to write some Python for a change this week.
Philip Durbin
@pdurbin
Aug 18 2018 22:31
How about you?