These are chat archives for FreeCodeCamp/HelpJavaScript

28th
Jul 2017
Diego Mayer
@Chrono79
Jul 28 2017 00:04
How I hate this FCC React Challenge Alpha shortcuts, shift+r deletes the code I wrote :angry:
why didn't they use ctrl instead of shift?
Christopher McCormack
@cmccormack
Jul 28 2017 00:09
what does shift+r normally do?
Diego Mayer
@Chrono79
Jul 28 2017 00:13
normally, R
I mean, when I type in an input
See http://hysterical-amusement.surge.sh/ Challenge React 30
Christopher McCormack
@cmccormack
Jul 28 2017 00:16
weird ctr+r reloads for me but shift r just gives me R
Kelechi Chinaka
@ke1echi
Jul 28 2017 00:19
i used the test code button :smile:
kumquatfelafel
@kumquatfelafel
Jul 28 2017 00:19
@Chrono79 Seriously?
That sounds incredibly annoying.
Diego Mayer
@Chrono79
Jul 28 2017 00:20
Yes, I can't type R inside the input, well, I can, but then the code dissapear
Tried both shifts, same result
kumquatfelafel
@kumquatfelafel
Jul 28 2017 00:21
paste? lol
Diego Mayer
@Chrono79
Jul 28 2017 00:21
Yes, pasting works
shift+s seems to trigger Solution Code too
dyon3334
@dyon3334
Jul 28 2017 00:25
Edit css with javascript
does anyone know good viideo about it
Kelechi Chinaka
@ke1echi
Jul 28 2017 00:29
[1,2,3,4,4,5,5,6,6] ==> [3,2,1,6,6,5,5,4,4] how do i use sort() to get that
Diego Mayer
@Chrono79
Jul 28 2017 00:32
that seems to sort in occurrence increasing order and value decreasing order
Nick Cleary
@Hijerboa
Jul 28 2017 00:35
Can anyone explain why my "streamers" which don't exist aren't getting pushed to the array for nonExistent streamers? https://codepen.io/hijerboa/pen/XgLQpd?editors=0012
Kelechi Chinaka
@ke1echi
Jul 28 2017 00:35
yea @Chrono79
jusgoose
@gusd773
Jul 28 2017 00:35
? @sjames1958gm so now I am doing array[i] - arrary[i+1] but it still doesn't work
kumquatfelafel
@kumquatfelafel
Jul 28 2017 00:36
arrary?
typo only here or in code itself?
jusgoose
@gusd773
Jul 28 2017 00:39
array* lol
only here i named it something else
Christopher McCormack
@cmccormack
Jul 28 2017 00:41
@Hijerboa how can you tell? You aren't displaying anything and have no log statements
Nick Cleary
@Hijerboa
Jul 28 2017 00:43
@cmccormack I do... It just appears that I'm editing it as your seeing it, so you obviously got a version where I had edited out the logs :P
Christopher McCormack
@cmccormack
Jul 28 2017 00:43
guess so
Nick Cleary
@Hijerboa
Jul 28 2017 00:43
and I think I figured it out: I was testing whether or not the user was streaming or not, rather than if they existed
and a non existent account obviously isn't streaming, so it got pushed to the offline array
facepalm
Christopher McCormack
@cmccormack
Jul 28 2017 00:44
haha
Nick Cleary
@Hijerboa
Jul 28 2017 00:44
I should probably take a break before I try to throw my keyboard out the window
kumquatfelafel
@kumquatfelafel
Jul 28 2017 00:46
@gusd773 post code
Kelechi Chinaka
@ke1echi
Jul 28 2017 00:56
@Chrono79 i think i need to check for occurrence of each element first
insouciantone
@insouciantone
Jul 28 2017 01:04
Hello all, i'm having a problem with some javascript. I'm doing the intermediate algorithm scripting challenge and I get stuck in an infinite loop and I'm not sure why.
after going passed 999 the for loop at line 9 gets stuck. If I lengthen the numbs array by adding an extra number it starts working but won't otherwise.
Long Nguyen
@longnt80
Jul 28 2017 01:08
@insouciantone what are you trying with this condition: +numbs[i] <= numCopy && +numbs[i] > numCopy
if I tried convertToRoman(501);, that condition will never meet, and numCopy is always 501, so it become infinite loop with the while
even with convertToRoman(500);, the value of numCopy is always 500, so infinite loop again
Long Nguyen
@longnt80
Jul 28 2017 01:14
btw, I think you need to write your numbs array from biggest number to smallest
John
@AnonymousLords
Jul 28 2017 01:15
Hey
I have a question
why wont this work?

function reverseString(str){
  for (i = 0; i < str.length; i++) {
    var array = str.split(str.length[i]);
    var arrayTwo = array.join(i);
    return arrayTwo.reverse();
  }
}
@kumquatfelafel
TypeError: arrayTwo.reverse is not a function
Stephen James
@sjames1958gm
Jul 28 2017 01:18
@gusd773 - I also notice that length() is wrong - length is a property not a function
Rather than mess with extra indexes, etc.
function makeArrayConsecutive2(statues) {
   var missingNumArray=[];
   var curr = statues[0];
   for (i=1; i<statues.length; i++){
        while (++curr <  statues[i]) {
           missingNumArray.push(curr);
        }
   }
   return missingNumArray.length
}
@AnonymousLords join returns a string so arrayTwo is not an array.
Also, str.length[i] makes no sense as str.length is a number.
Review the challenges on split and join to see what values they take as parameters
John
@AnonymousLords
Jul 28 2017 01:20
okay
Stephen James
@sjames1958gm
Jul 28 2017 01:21
@AnonymousLords If you use split / reverse/ join - you don't need a for loop
John
@AnonymousLords
Jul 28 2017 01:22
Oh
John
@AnonymousLords
Jul 28 2017 01:27
@sjames1958gm How isn't this a funtion return array.reverse();
Stephen James
@sjames1958gm
Jul 28 2017 01:28
@AnonymousLords
if array does not contain an array then array.reverse() is not a function.
John
@AnonymousLords
Jul 28 2017 01:28
function reverseString(str){
    var array = str.split(/\s/g)
    var array = array.join(" ");
    return array.reverse();

}

reverseString("helo");
Stephen James
@sjames1958gm
Jul 28 2017 01:29
@AnonymousLords join returns a string - you want to reverse between the split and join
@AnonymousLords Are you sure you want to split / join on spaces? that will reverse words not characters
John
@AnonymousLords
Jul 28 2017 01:30
so /\S/g
Stephen James
@sjames1958gm
Jul 28 2017 01:31
@AnonymousLords no ("") use empty string to split between characters
abraham anak agung
@padunk
Jul 28 2017 01:31
Good Morning coders. One simple question what is the difference between .map and for...of loops? seem same to me
Stephen James
@sjames1958gm
Jul 28 2017 01:32
@padunk .map returns an array built from the return values from the callback function, for .. of does not
abraham anak agung
@padunk
Jul 28 2017 01:33
@sjames1958gm ah of course. Thank you sir
CamperBot
@camperbot
Jul 28 2017 01:33
padunk sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8176 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jul 28 2017 01:33
@padunk :+1:
John
@AnonymousLords
Jul 28 2017 01:33
am i close

function reverseString(str){
    var array = str.split();
    var array = array.reverse();
    return array.join(" ");
}

reverseString("helo");
@sjames1958gm
Stephen James
@sjames1958gm
Jul 28 2017 01:35
@AnonymousLords Yes, just fix your parameters to split and join so they split between characters and join without inserting anything.
both require "" as parameters
@AnonymousLords var array = array.reverse(); note this can simply be array.reverse() because reverse changes the array it is called on
John
@AnonymousLords
Jul 28 2017 01:36
hummm
okay
humm spliting between characters
like every chacacter is split
\S does chacters
this returns literally nothing

function reverseString(str){
    var array = str.split(/\S/g);
    array.reverse();
    return array.join("");
}

reverseString("helo");
@sjames1958gm
kumquatfelafel
@kumquatfelafel
Jul 28 2017 01:46
@AnonymousLords Split removes matches as well as "splitting" at that location. Since you have it matching \S, you are splitting at/removing all \S.
John
@AnonymousLords
Jul 28 2017 01:47
so every chacater
GitHubLxx741
@GitHubLxx741
Jul 28 2017 01:47
hi
John
@AnonymousLords
Jul 28 2017 01:48
@GitHubLxx741 Welcome to FCC
kumquatfelafel
@kumquatfelafel
Jul 28 2017 01:48
@AnonymousLords all non-whitespace characters will not be present in the resulting array.
John
@AnonymousLords
Jul 28 2017 01:48
Okay
how would i do both? @kumquatfelafel
kumquatfelafel
@kumquatfelafel
Jul 28 2017 01:49
@AnonymousLords The reason @sjames1958gm mentioned using "" instead is that split handles this situation by splitting apart every character without actually removing any characters.
John
@AnonymousLords
Jul 28 2017 01:50
YES THANKS @kumquatfelafel @sjames1958gm
CamperBot
@camperbot
Jul 28 2017 01:50
anonymouslords sends brownie points to @kumquatfelafel and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 547 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
:star2: 8177 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jul 28 2017 01:50
@AnonymousLords :+1:
John
@AnonymousLords
Jul 28 2017 01:51

function reverseString(str){
    var array = str.split("");
    array.reverse();
    return array.join("");
}
I didnt know .split knew where to split
i thought it need direction/ liek a agurment
Stephen James
@sjames1958gm
Jul 28 2017 01:51
@AnonymousLords "" is like a special case, saying split between characters.
John
@AnonymousLords
Jul 28 2017 01:52
Okay thanks
Ill write all of thsi down
gr8 lost my pen :pensive:
nvm
fdemaa
@fdemaa
Jul 28 2017 01:53
Anyone know what can i use to add a audio file to my font awesome icon ? i use the audio tag from html5,but it adds a audio player to my page, its not what i want;
John
@AnonymousLords
Jul 28 2017 01:55
I am not sure, but i guess it would have something to do with jQurey
Luminary
@Edsheerans
Jul 28 2017 01:56
is there someone can help me solve a question
John
@AnonymousLords
Jul 28 2017 01:57
Im sure someone can
xdl
@XuDongling
Jul 28 2017 01:58
Anyone could tell me that why palindrome("race car") return true, but palindrome("never odd or even") doesn't return true?
Luminary
@Edsheerans
Jul 28 2017 01:58
var myPlants = [
{
type: "flowers",
list: [
"rose",
"tulip",
"dandelion"
]
},
{
type: "trees",
list: [
"fir",
"pine",
"birch"
]
}
];
John
@AnonymousLords
Jul 28 2017 01:58
@Edsheerans use ```
xdl
@XuDongling
Jul 28 2017 01:58

var code = "function palindrome(str) {
// 请把你的代码写在这里
str = str.replace(/[^a-zA-Z0-9]/,'');
str = str.toLowerCase();
var arr = str.split("");
arr.reverse();
var newstr = arr.join("");
if (str == newstr)
{return true;} else {
return false;
}
}

palindrome("eye");"

Luminary
@Edsheerans
Jul 28 2017 01:59
I want to index secondtree
John
@AnonymousLords
Jul 28 2017 01:59
Gusy format yoru code, its so hard to read
Var
Luminary
@Edsheerans
Jul 28 2017 02:00
ok
John
@AnonymousLords
Jul 28 2017 02:00
myPlants[1]
im guessing
Theirs 2 types
liek 2 objects
0 = 1
1 = 2
kumquatfelafel
@kumquatfelafel
Jul 28 2017 02:01

@XuDongling

...tell me [why] palindrome("never odd or even") doesn't return true?

It's supposed to return true. Can't tell you why or why not without seeing your code though.

nvm
John
@AnonymousLords
Jul 28 2017 02:01
Luminary
@Edsheerans
Jul 28 2017 02:01
var secondTree = myPlants[1].list[1];
John
@AnonymousLords
Jul 28 2017 02:01
@Edsheerans access properties
Luminary
@Edsheerans
Jul 28 2017 02:01
I know it
John
@AnonymousLords
Jul 28 2017 02:01
myPlant[1][1]
Luminary
@Edsheerans
Jul 28 2017 02:02
Thank you
Moisés Man
@moigithub
Jul 28 2017 02:02
@XuDongling add /g flag to ur replace
soo it replace ALL ocurrences.. not only first
John
@AnonymousLords
Jul 28 2017 02:02
2nd object, second property
@Edsheerans did it work?
Luminary
@Edsheerans
Jul 28 2017 02:02
it works
John
@AnonymousLords
Jul 28 2017 02:02
:)
xdl
@XuDongling
Jul 28 2017 02:02
Thank you very much
Luminary
@Edsheerans
Jul 28 2017 02:02
I have solved it
Thanks John
abraham anak agung
@padunk
Jul 28 2017 02:03
@XuDongling why you wrap your function with ""?
John
@AnonymousLords
Jul 28 2017 02:03
@Edsheerans @XuDongling "thanks @person"
without the "
xdl
@XuDongling
Jul 28 2017 02:03
I don't know grammar of Markdown well
kumquatfelafel
@kumquatfelafel
Jul 28 2017 02:03

@XuDongling For future: if you write it in a code block, it makes it easier to read and allows you to do some formatting. To write it in a code block...
for one line :point_right: ` code goes here `
or for multiple lines :point_down:
```js
code goes here (important: on a separate line)
```

Also, note that `≠ '
You can also edit your post if you make a mistake by clicking the … that appears when you hover your mouse over your comment
.

xdl
@XuDongling
Jul 28 2017 02:04
thanks @moigithub
CamperBot
@camperbot
Jul 28 2017 02:04
xudongling sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3536 | @moigithub |http://www.freecodecamp.com/moigithub
John
@AnonymousLords
Jul 28 2017 02:05
formatting code @XuDongling @kumquatfelafel @Edsheerans
xdl
@XuDongling
Jul 28 2017 02:05
I got it, thank you @kumquatfelafel
CamperBot
@camperbot
Jul 28 2017 02:05
xudongling sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 548 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
abraham anak agung
@padunk
Jul 28 2017 02:06
@XuDongling you don't need that and if you write a function expression like that, you need to add; at the end. And you call your function with code("eye")
xdl
@XuDongling
Jul 28 2017 02:07
OK, thank you for your suggestion @padunk
CamperBot
@camperbot
Jul 28 2017 02:07
xudongling sends brownie points to @padunk :sparkles: :thumbsup: :sparkles:
:cookie: 381 | @padunk |http://www.freecodecamp.com/padunk
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 02:09
Is the pomodoro supposed to make a sound?
abraham anak agung
@padunk
Jul 28 2017 02:09
@baseballpoetess not really, but it is a good thing to have one. It let you know that it is a time to break or start working
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 02:09
The sample one doesn't on my computer but without checking the code, I dunno if it's supposed to or not.
Okay, thanks @padunk
CamperBot
@camperbot
Jul 28 2017 02:10
baseballpoetess sends brownie points to @padunk :sparkles: :thumbsup: :sparkles:
:cookie: 382 | @padunk |http://www.freecodecamp.com/padunk
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 02:10
I want to do the right thing but without being certain what that is, I'm a bit lost.
abraham anak agung
@padunk
Jul 28 2017 02:10
@baseballpoetess :+1:
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 02:11
Next question, what's the best way to do sound?
(not code, but what should I be reading about)
abraham anak agung
@padunk
Jul 28 2017 02:15
@baseballpoetess i like w3schools.com but some people don't https://www.w3schools.com/jsref/met_audio_play.asp
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 02:17
so it is play() method. thank you again (but it's an hour before I can give you more cookies)
abraham anak agung
@padunk
Jul 28 2017 02:17
@baseballpoetess lol, i like a real one...
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 02:18
:cookie:
it's called "Video and Audio Players" and maybe has something useful.
and yes,it does.....
l8r while i fall down this rabbit hole ....
Manish Giri
@Manish-Giri
Jul 28 2017 02:21
@baseballpoetess take a look at - https://howlerjs.com/
I used this for my simon game.
jusgoose
@gusd773
Jul 28 2017 02:23

@kumquatfelafel function makeArrayConsecutive2(statues) {
var missingNumArray=[];
for (i=0; i<statues.length(); i++){
if (statues[i]-statues[i+1]!=1){
var x = (statues[i]-statues[i-1]);
var j = 1;
while (j<x){
missingNumArray.push(statues[i+1]+j);
j++;

        }
    }


}
return missingNumArray.length();

}

kumquatfelafel
@kumquatfelafel
Jul 28 2017 02:25

@gusd773 statues.length, missingNumArray.length. length is an array property, not a function.

Do you have link to what you're working on?

Joshua Friedman
@jsf2008
Jul 28 2017 02:38
Can someone please tell me why my AI won't work on my tic-tac-toe game please!
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 02:58
thanks @Manish-Giri but I had logged off. :)
CamperBot
@camperbot
Jul 28 2017 02:58
baseballpoetess sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6327 | @manish-giri |http://www.freecodecamp.com/manish-giri
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 02:58
abraham anak agung
@padunk
Jul 28 2017 02:59
@jsf2008 haven't look at your code yet. i'm on that project too, but i suggest do it step by step. user step, ai step. user step, ai step. I'm currently on second ai move :smile:
@baseballpoetess is it done?
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 03:03
I think so.
but I could be mistaken
kumquatfelafel
@kumquatfelafel
Jul 28 2017 03:03
@jsf2008 Looking at code, there are issues with your winOrLose as well. When I change sq1 - 9 to id's as opposed to classes and having $("#sq1") etc, I'm able to make it recognize win. Alternatively, keeping sq1-9 as class, but changing to $(".sq1"), recognizes wins as well. Looking at rest of code. May be a little.
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 03:03
(I thought my calculator was done till I showed it to people)
abraham anak agung
@padunk
Jul 28 2017 03:04
cause when i hit start and start again your clock become weird, and you should disable the + - button when it start. Pause button will be good thing, but not necessary
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 03:04
okay. That's the kind of thing I meant.
Joshua Friedman
@jsf2008
Jul 28 2017 03:05
@kumquatfelafel my sq's are all ID's already tho
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 03:05
ty @padunk (has it been an hour? I dunno)
CamperBot
@camperbot
Jul 28 2017 03:05
baseballpoetess sends brownie points to @padunk :sparkles: :thumbsup: :sparkles:
:warning: baseballpoetess already gave padunk points
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 03:05
no
Joshua Friedman
@jsf2008
Jul 28 2017 03:05
i lied they're classes
abraham anak agung
@padunk
Jul 28 2017 03:06
lol, nvm the cookies @baseballpoetess
kumquatfelafel
@kumquatfelafel
Jul 28 2017 03:06
@jsf2008 class is fine too, you just have to refer to it properly (don't use the #)
Joshua Friedman
@jsf2008
Jul 28 2017 03:08
That's what I was overlooking
But now my problem is I'm only getting one X and the CPU is getting to drop an O every time
kumquatfelafel
@kumquatfelafel
Jul 28 2017 03:10
@jsf2008 Two more things, you need to have it switch back from cpu. And play again not functioning properly.
Joshua Friedman
@jsf2008
Jul 28 2017 03:10
That
I created the program on Cloud9 and did a copy paste into codepen
location.reload() doesn't work on codepen
kumquatfelafel
@kumquatfelafel
Jul 28 2017 03:11
@jsf2008 how did you tell it to switch from human to cpu? Follow-up: Did you tell it to do the exact same thing to switch back?
Joshua Friedman
@jsf2008
Jul 28 2017 03:12
my else statement
.addClass
I just didn't get it to loop back to player
and I just figured that out by switching the player in my else statement
from player = 2 to player =1
kumquatfelafel
@kumquatfelafel
Jul 28 2017 03:14

from player = 2 to player =1

aye, that'll do it.

J-Mag Guthrie
@baseballpoetess
Jul 28 2017 03:15
@padunk I may have fixed those issues.
Joshua Friedman
@jsf2008
Jul 28 2017 03:15
the last 2 things I need to add are sound bit's for winning and creating a stalemate
that's just me being a perfectionist, but more or less this bad boy is ready to turn in
abraham anak agung
@padunk
Jul 28 2017 03:16
@baseballpoetess :+1:
J-Mag Guthrie
@baseballpoetess
Jul 28 2017 03:16
I'm off to sleep. code creeps while you sleep and may quit working. it's alos past 22:00 here.
thank you again.
well, not quite yet -- there's a kernel update.
pahosler
@pahosler
Jul 28 2017 03:22
is anyone here able to help a React noob tonight???
Ronique Ricketts
@RoniqueRicketts
Jul 28 2017 03:22
This message was deleted
abraham anak agung
@padunk
Jul 28 2017 03:23
@pahosler perhaps.
when I change the text in the text area the output isn't changing, and I'm not sure why...
I can log the change, but <Output /> is only called once, it isn't called after changeOutput fires
abraham anak agung
@padunk
Jul 28 2017 03:26
@pahosler line 10 that is no how you setState. this.setState = ({...})
pahosler
@pahosler
Jul 28 2017 03:27
ES6 change lets that work...
abraham anak agung
@padunk
Jul 28 2017 03:27
Ooo, ok . my mistake then. sorry should be this.setState ({ input : input})
pahosler
@pahosler
Jul 28 2017 03:27
I get the same non results when I
I've tried this.setState(this.state.input=input)
ooops I'd forgot to change it back to this... this.setState.input = ({input}); but that isn't working wither
either
abraham anak agung
@padunk
Jul 28 2017 03:30
@pahosler it work? no = this.setState({input: input})
pahosler
@pahosler
Jul 28 2017 03:30
shoot wait...
AH!, lemme try that :O
abraham anak agung
@padunk
Jul 28 2017 03:31
it worked here
pahosler
@pahosler
Jul 28 2017 03:31
OMG yes, that worked, I feel silly LOL
I don't know how or why I did it that other way, got cross-eyed looking at it I suppose
thank you @padunk !!!!!!!!!!!!!!!!!!
CamperBot
@camperbot
Jul 28 2017 03:32
pahosler sends brownie points to @padunk :sparkles: :thumbsup: :sparkles:
:cookie: 383 | @padunk |http://www.freecodecamp.com/padunk
abraham anak agung
@padunk
Jul 28 2017 03:32
@pahosler np, i sometimes make that mistake too, this syntax thing is killing my old brain sometimes :smile:
pahosler
@pahosler
Jul 28 2017 03:33
now to make it render the markdown correctly :D :D
thanks again, I feel about 90% better now LOL
abraham anak agung
@padunk
Jul 28 2017 03:33
@pahosler not there yet, still make my AI move for tictactoe, good luck
pahosler
@pahosler
Jul 28 2017 03:34
tictactoe was a fun project, very challenging :D
abraham anak agung
@padunk
Jul 28 2017 03:35
yes, still making function for AI move. do you make separate function for each step?
pahosler
@pahosler
Jul 28 2017 03:35
Pomodoro was fun too, I didn't want to do Simon, not a fan of the game, but it turned out really nice
not exactly... feel free to look at my codepen for some ideas, the code is laid out pretty well
abraham anak agung
@padunk
Jul 28 2017 03:36
I don't know Simon game untill i try it. should be challenging project :smile: . :+1:
pahosler
@pahosler
Jul 28 2017 03:37
I had a lot of if/else if statements, but I codified them into a sweet little function :D
jusgoose
@gusd773
Jul 28 2017 03:37
@sjames1958gm why would I push (curr) when in the while loop you refer to ++curr?
abraham anak agung
@padunk
Jul 28 2017 03:38
@pahosler yes i do that too, but i leave it there for now. after it finish then i refactor the code
pahosler
@pahosler
Jul 28 2017 03:38
the function made it easy to add blocks against the human opponent during test plays :D
abraham anak agung
@padunk
Jul 28 2017 03:41
@pahosler your tictactoe is fun. there is a easy level too :smile: i was thinking of the same lol.
got to go. good luck at your markdown project.
Joseph
@revisualize
Jul 28 2017 03:43
Hello.
pahosler
@pahosler
Jul 28 2017 03:43
good luck to you too @padunk and happy coding
Jonathan Mancia
@jonmancia
Jul 28 2017 04:28
What I'm I doing wrong?
function lookUpProfile(firstName, prop) {

  for (var i = 0; i < contacts.length; i++) {
    if (contacts[i].firstName == firstName) {
        if (contacts[i][prop] == prop) {
          return contacts[i][prop];
         }
    }
  }

}
It does not return the prop from the object but if I console.log it works just fine.
Joseph
@revisualize
Jul 28 2017 04:30
@jonmancia (contacts[i][prop] == prop) shouldn't be part of the if condition.
@jonmancia You just need to check if the prop exists.
@jonmancia The only time (contacts[i][prop] == prop) will be true is if the property key and property value are both the same.
Jonathan Mancia
@jonmancia
Jul 28 2017 04:32
Ahhh I see what you mean!
How do check if the prop exists within that object though?
Joseph
@revisualize
Jul 28 2017 04:34
@jonmancia How do you test if a object property exists?
Jonathan Mancia
@jonmancia
Jul 28 2017 04:34
(contacts[i][prop])
Joseph
@revisualize
Jul 28 2017 04:34
@jonmancia If there was only a way you could... Testing Objects for Properties
Jonathan Mancia
@jonmancia
Jul 28 2017 04:34
Amazing Joseph
Joseph
@revisualize
Jul 28 2017 04:34
Maybe there is a lesson.
About that very thing?
Jonathan Mancia
@jonmancia
Jul 28 2017 04:35
You're right. Thank you @revisualize !
CamperBot
@camperbot
Jul 28 2017 04:35
jonmancia sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4385 | @revisualize |http://www.freecodecamp.com/revisualize
Jonathan Mancia
@jonmancia
Jul 28 2017 04:37
It seems like I have to start with JS again. It's been awhile
fdemaa
@fdemaa
Jul 28 2017 05:05
any feedback i think i finish it, i have to correct the responsive design ;
https://codepen.io/fdemaa/pen/NgmWvm?editors=0010
Long Nguyen
@longnt80
Jul 28 2017 05:14
@fdemaa that music is not GoT track, isn't it?
fdemaa
@fdemaa
Jul 28 2017 05:15
@longnt80 haha no its not.. im not sure to put a got song, maybe is way over the top?
how are you man ?
Long Nguyen
@longnt80
Jul 28 2017 05:15
@fdemaa I consider that a major bug
fix it
:D
I'm good
how are you
fdemaa
@fdemaa
Jul 28 2017 05:16
all good ; how its going the twitter proyect
Ankur sharma
@ankur1163
Jul 28 2017 05:17
h
hi
can someone tell me
Long Nguyen
@longnt80
Jul 28 2017 05:17
haven't started yet
Ankur sharma
@ankur1163
Jul 28 2017 05:17
how to learn UI UX
any best course for it?
Long Nguyen
@longnt80
Jul 28 2017 05:17
@fdemaa I'll get to it next Monday
Joseph
@revisualize
Jul 28 2017 05:17
@ankur1163 Let me check a website.
Ankur sharma
@ankur1163
Jul 28 2017 05:19
well, I did look at udemy course
top one looks outdated
@revisualize
Joseph
@revisualize
Jul 28 2017 05:19
Ok.
@ankur1163 Change the search to only show you results for the last year. or 6 months
@ankur1163 Do you draw?
Long Nguyen
@longnt80
Jul 28 2017 05:23
@revisualize stick figures
Joseph
@revisualize
Jul 28 2017 05:24
Then you're screwed if you want to excel at UI.
Ankur sharma
@ankur1163
Jul 28 2017 05:24
ok
@revisualize
Joseph
@revisualize
Jul 28 2017 05:25
@ankur1163 You don't need to be a good artist. But, you need to have some sense of drawing ability.
Ankur sharma
@ankur1163
Jul 28 2017 05:25
@revisualize I have a product idea.
Joseph
@revisualize
Jul 28 2017 05:25
Ok.
Ankur sharma
@ankur1163
Jul 28 2017 05:25
I want to team up with someone good in angular
i want to convey my idea
Joseph
@revisualize
Jul 28 2017 05:25
Good luck.
Ankur sharma
@ankur1163
Jul 28 2017 05:25
so, i am thinking i should create several UI designs
thanks
so other person also knows what exactly i want
its all in my head
Joseph
@revisualize
Jul 28 2017 05:26
@ankur1163 Why not just create wireframes?
Ankur sharma
@ankur1163
Jul 28 2017 05:26
true
but i have no clue what wireframe tools to use
Joseph
@revisualize
Jul 28 2017 05:26
@ankur1163 What do you offer besides your "idea"?
@ankur1163 PENCIL AND PAPER
Ankur sharma
@ankur1163
Jul 28 2017 05:26
lol
yeah
but , something advanced should also work
Long Nguyen
@longnt80
Jul 28 2017 05:27

PENCIL AND PAPER

was about to say that

Joseph
@revisualize
Jul 28 2017 05:27
@ankur1163 If you don't know HIGH TECH
Go low tech and take a picture.
Done.
Long Nguyen
@longnt80
Jul 28 2017 05:27
@ankur1163 are you a designer?
Ankur sharma
@ankur1163
Jul 28 2017 05:27
well, i want to done it right
no
@longnt80
Joseph
@revisualize
Jul 28 2017 05:27
@ankur1163 Fuck done right.
Ankur sharma
@ankur1163
Jul 28 2017 05:27
what 's tool pros use to get wire framing done?
Joseph
@revisualize
Jul 28 2017 05:28
@ankur1163 Pencil and Paper
Long Nguyen
@longnt80
Jul 28 2017 05:28
well, pen and paper is still the right tool for seasoned UI, UX designer
Ankur sharma
@ankur1163
Jul 28 2017 05:28
lol
Joseph
@revisualize
Jul 28 2017 05:28
@ankur1163 seriously.
Ankur sharma
@ankur1163
Jul 28 2017 05:28
hmmm ok
Long Nguyen
@longnt80
Jul 28 2017 05:28
it's true
Joseph
@revisualize
Jul 28 2017 05:28
@ankur1163 Let me link you a video.
Ankur sharma
@ankur1163
Jul 28 2017 05:28
ok
Long Nguyen
@longnt80
Jul 28 2017 05:28
there are many software but it depends on each company
Ankur sharma
@ankur1163
Jul 28 2017 05:29
ok
Joseph
@revisualize
Jul 28 2017 05:29
Don't just watch this video. But, look in the background. Look at how many people are working from paper before moving to the computer.
https://www.youtube.com/watch?v=FR8Qf6kgIAA
Long Nguyen
@longnt80
Jul 28 2017 05:29
@ankur1163 so pencil and paper is the universal tool that can work everywhere
cheap, fast and effective
Joseph
@revisualize
Jul 28 2017 05:30
@ankur1163 Do you see how in just the first 25 seconds.
Pencil and Paper
__mifflin__
@cdrainxv
Jul 28 2017 05:30
draw.io is free
Long Nguyen
@longnt80
Jul 28 2017 05:31
@ankur1163 I know how to use Photoshop, Illustrator and have used some wireframing software
pencil and paper is still very effective
Joseph
@revisualize
Jul 28 2017 05:33
@ankur1163 So, that video is a professional design studio. Everyone works from pencil and paper
@ankur1163 You can see it from the video.
@ankur1163 Just look at the background.
Long Nguyen
@longnt80
Jul 28 2017 05:34
@revisualize I agee with what you said but that video is about design studio so drawing is mandatory, therefore lots of drawings
Ankur sharma
@ankur1163
Jul 28 2017 05:40
ok
thanks @revisualize and @longnt80
CamperBot
@camperbot
Jul 28 2017 05:40
ankur1163 sends brownie points to @revisualize and @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 469 | @longnt80 |http://www.freecodecamp.com/longnt80
:star2: 4386 | @revisualize |http://www.freecodecamp.com/revisualize
Ankur sharma
@ankur1163
Jul 28 2017 05:40
I got it that i need to use pencil paper
but let's say i have 100 pages with lot of things going on
eventually i have to use some professional tool right?
but i understand what you guys are sayng
start with simple pen and paper
Joseph
@revisualize
Jul 28 2017 05:41
@ankur1163 why?
@ankur1163 Do you have a camera?
Take pictures of paper
Long Nguyen
@longnt80
Jul 28 2017 05:41
@ankur1163 softwares are personal/company's preference
you can't know which one is right
but all companies can work with pencil and paper
Joseph
@revisualize
Jul 28 2017 05:42
@ankur1163 Seriously, I know some web designers here in Seattle that work for big companies. They don't use professional software for wireframing or scoping their builds.
@ankur1163 Sure, you could use https://balsamiq.com/products/mockups/
@ankur1163 There is also https://www.axure.com/
Long Nguyen
@longnt80
Jul 28 2017 05:44
let say you want to use balsamiq, you spend lots of time learning to use it
then you join a company but they already use something else for wireframing
Joseph
@revisualize
Jul 28 2017 05:45
Pencil and Paper.
LOL!
Ankur sharma
@ankur1163
Jul 28 2017 05:49
he he
lol
@longnt80 and @revisualize
Markus Kiili
@Masd925
Jul 28 2017 05:53
@revisualize I was in one software development course two years ago (with young people). I wrote one document on paper and everyone stared at me like I was some insane dinosaur.
Joseph
@revisualize
Jul 28 2017 05:53
@Masd925 LOL!
iso
@iso1048
Jul 28 2017 05:53

Ive got an arrangement as follows:

<tr class='added-paper'>
           <td class="t-data latest-credit">` + credit +`</td>
           <td class="t-data latest-grade">` + grade + `</td>
           <td class='delete-btn t-data'>delete</td>
        </tr>

within a function which is triggered by clicking of 'delete,' I want to access the credit variable, by using this (which refers to delete-btn). How could I do this?

Joseph
@revisualize
Jul 28 2017 05:54
@Masd925 WTF did they use?!
Markus Kiili
@Masd925
Jul 28 2017 05:54
@revisualize Computer programs.
Long Nguyen
@longnt80
Jul 28 2017 05:55

@revisualize I was in one software development course two years ago (with young people). I wrote one document on paper and everyone stared at me like I was some insane dinosaur. @Masd925

well, writting a document in paper can be weird in this age
but designing, wireframing is differrent

my handwritting is getting ugly because I haven't written with pens for so long
Markus Kiili
@Masd925
Jul 28 2017 05:57
@longnt80 Yeah, it was a sketch about the database structure of the program. It had like 50 tables so it would have taken very long to do it with some program.
And the idea was to show how insane the project would be on a school course.
Markus Kiili
@Masd925
Jul 28 2017 06:44
@ysfscream You need to loop those subarrays and figure out the largest number of the subarray. You can use loops or methods like .map() and Math.max().
Tiago Correia
@tiagocorreiaalmeida
Jul 28 2017 07:50
hey
https://codepen.io/tiagocorreia/pen/QMWPQB need help on 2 things about css, first How can I avoid the p tag that shows keys pressed to grow more than it own size, and second why when I use AC or I use CE unthil I clear everything about the css goes crazy?:D
YuShifan
@ysfscream
Jul 28 2017 08:02
@Masd925 Oh yeah! Thank you! Just now I solved this problem, I use the Math.max.apply(), I will find another methods to solve, Thank you, lol, My English is not well, please forgive me😀
CamperBot
@camperbot
Jul 28 2017 08:02
ysfscream sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4352 | @masd925 |http://www.freecodecamp.com/masd925
Rajat
@rajataudichya
Jul 28 2017 08:21

// Example
var ourArr = [ 9, 10, 11, 12];
var ourTotal = 0;

for (var i = 0; i < ourArr.length; i++) {
  ourTotal += ourArr[i];
}

// Setup
var myArr = [ 2, 3, 4, 5, 6];
var total = 0;

for (var i = 0; i <  myArr.length; i++) {
  total += myArr[i];

}


// Only change code below this line
Challenge link
I have completed the challenge but I have not understood it quite wwell
The final answers total = 20 but can some one explain me how is it two
Marianissimus
@Marianissimus
Jul 28 2017 08:23
@rajataudichya ok, it's quite easy. you have an array and a "placeholder", a variable that will hold the value of the result - ourTotal
Rajat
@rajataudichya
Jul 28 2017 08:23
as per me length of the array is 5 so variable var i should be less than 5 and is incremented so the total should be ?
Darth Skywalker
@AdiSkywalker
Jul 28 2017 08:23
@rajataudichya
Initial setup

myArr = [1,2,3,4,5];
total = 0;

Loop Starts with i = 0

i = 0 -> is i less than myArr.length ? Yes -> total = total + myArr[i] => total = 0 + myArr[0] => total =  0 + 1 =>  total = 1
i = 1 -> is i less than myArr.length ? Yes -> total = total + myArr[i] => total = 1 + myArr[1] => total =  1 + 2 =>  total = 3
i = 2 -> is i less than myArr.length ? Yes -> total = total + myArr[i] => total = 3 + myArr[2] => total =  3 + 3 =>  total = 6
i = 3 -> is i less than myArr.length ? Yes -> total = total + myArr[i] => total = 6 + myArr[3] => total =  6 + 4 =>  total = 10
i = 4 -> is i less than myArr.length ? Yes -> total = total + myArr[i] => total = 10 + myArr[4] => total =  10 + 5 =>  total = 15
i = 5 -> is i less than myArr.length ? No! Stop
Marianissimus
@Marianissimus
Jul 28 2017 08:24
as you loop through the array (go through each item), you add the value of each item of the array to the result
for instance, when you first loop -=> ourArr[0] = 9; ourTotal gets that value added to it (0+9 = 9)
before the second loop, you have this: ourTotal = 9; ok so far?
now, the 2nd loop: ourArr[1] = 10; you add this to ourtotal, so ourtotal becomes 9 + 10 = 19
so on until you finish the array
same goes for the setup: inital values - total = 0;
first loop: total += myArr[i], which is myArr[0], which is 2; now total = 2
2nd loop total += myArr[i], which is now 1, so myArr[1], which has the value of 3; so now total = 2+3 = 5;
so on...
Rajat
@rajataudichya
Jul 28 2017 08:31
@AdiSkywalker Thanks
CamperBot
@camperbot
Jul 28 2017 08:31
rajataudichya sends brownie points to @adiskywalker :sparkles: :thumbsup: :sparkles:
:cookie: 247 | @adiskywalker |http://www.freecodecamp.com/adiskywalker
Muhammad Hasham
@MohammadHasham
Jul 28 2017 08:45
can anyone help me with markdown previwer?
Tiago Correia
@tiagocorreiaalmeida
Jul 28 2017 08:50
is there anyway to avoid this by just using css?
image.png
Marianissimus
@Marianissimus
Jul 28 2017 08:50
@tiagocorreiaalmeida a max-width maybe for that div?
wonder
@wonder2991
Jul 28 2017 08:50
@tiagocorreiaalmeida overflow:hidden
but, why don't just limit the digits in js
Tiago Correia
@tiagocorreiaalmeida
Jul 28 2017 08:51
that's a good way @wonder2991 but I creates me another litle problem :D
it*
now when I use a number I can't see him xd
tought of that but didnt wanted to make i
it
wonder
@wonder2991
Jul 28 2017 08:53
i don't think hiding the digits is a good idea
Marianissimus
@Marianissimus
Jul 28 2017 08:55
maybe a maxlength? basically that's what you need to do, anyway
Tiago Correia
@tiagocorreiaalmeida
Jul 28 2017 09:12
probably going that way thanks
Huỳnh Trần Khanh
@khanh2003
Jul 28 2017 09:16
sorry for advertising but here is my free code camp calculator: http://calculating.netlify.com/
any feedback is much appreciated
Long Nguyen
@longnt80
Jul 28 2017 09:18
@khanh2003 does the AC has any purpose?
Huỳnh Trần Khanh
@khanh2003
Jul 28 2017 09:18
no, its for fun
PortaX
@PortaX
Jul 28 2017 09:19
Can anyone help me with this?
function multiplier ( factor ) {
return function ( number ) {
return number * factor ;
};
}
var twice = multiplier (2) ;
console . log ( twice (5) ) ;
// → 10
Long Nguyen
@longnt80
Jul 28 2017 09:21
@khanh2003 for usability, I think you should display the math operators
also, I can click .2.3.4.5., your calc doesn't take this number but you should prevent user from doing this
everything else works as expected
Long Nguyen
@longnt80
Jul 28 2017 09:29
@PortaX what do you need help with?
PortaX
@PortaX
Jul 28 2017 09:35
I understood it, I couldn't understand how it worked..
Manish Giri
@Manish-Giri
Jul 28 2017 09:36
@PortaX the multiplier function returns a reference to another function, which you store in twice
Then you call twice just like a regular function, with the value 5 in this case
Muhammad Hasham
@MohammadHasham
Jul 28 2017 09:42
can anyone help me with markdown previewer
Long Nguyen
@longnt80
Jul 28 2017 09:43
@PortaX here's the illustration:
with this line: var twice = multiplier (2) ; you will have the equivalent of:
var twice = function ( number ) { 
return number * 2 ; 
};
James Barrett
@jamesbarrett95
Jul 28 2017 09:53
Hello chaps, I have a function:
```
Oh damn the web version doesn't seem to format my sentences correctly haha
Bare with
function getPattern (sequence) {
  sequence.map(pod => pod.classList.add('playing'))
}
Does anyone know how I can execute pod.classList.add('playing')
Every 2 seconds?
Is it merely a case of wrapping a setTimeout around it?
Markus Kiili
@Masd925
Jul 28 2017 09:58
@jamesbarrett95 Sounds like a job for setInterval() https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Timers
James Barrett
@jamesbarrett95
Jul 28 2017 10:02
Looks like the solution! Thanks @Masd925
CamperBot
@camperbot
Jul 28 2017 10:02
jamesbarrett95 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4353 | @masd925 |http://www.freecodecamp.com/masd925
Muhammad Hasham
@MohammadHasham
Jul 28 2017 10:07
can anyone help with markdown previewer?
teevik
@teevik
Jul 28 2017 10:08
Whats the problem?
Muhammad Hasham
@MohammadHasham
Jul 28 2017 10:08
i am getting the html source not the exacct html
i am getting <h1>Heading</h1> instead of Heading
@teevik
teevik
@teevik
Jul 28 2017 10:09
Do you mean it's given as a string and not react component? Sorry i dont understand
Muhammad Hasham
@MohammadHasham
Jul 28 2017 10:09
Yeah! that is the problem.

class App extends React.Component{
  render(){
    var md = new Remarkable();
    md.set({
       html:true,
      linkify:true
    });
    return(
      <div>{md.render('# Remarkable rulezz!')}</div>
    );
  }
}

ReactDOM.render(<App/>,document.getElementById('root'));
teevik
@teevik
Jul 28 2017 10:10
Pretty sure you need to use dangerouslySetInnerHTML
Muhammad Hasham
@MohammadHasham
Jul 28 2017 10:11
okay actually i am using remarkable.js
instead of marked.js
SmoothMove2000
@SmoothMove2000
Jul 28 2017 10:12
teevik
@teevik
Jul 28 2017 10:12
Pretty sure it should work anyways
It works like dangerouslySetInnerHTML={ {__html: "<h1>Text</h1>"} }
Muhammad Hasham
@MohammadHasham
Jul 28 2017 10:18
@teevik thanks a ton
CamperBot
@camperbot
Jul 28 2017 10:18
mohammadhasham sends brownie points to @teevik :sparkles: :thumbsup: :sparkles:
:cookie: 212 | @teevik |http://www.freecodecamp.com/teevik
Muhammad Hasham
@MohammadHasham
Jul 28 2017 10:18
that worked
@teevik thank you
CamperBot
@camperbot
Jul 28 2017 10:18
mohammadhasham sends brownie points to @teevik :sparkles: :thumbsup: :sparkles:
:warning: mohammadhasham already gave teevik points
teevik
@teevik
Jul 28 2017 10:22
nice
WAINGOR
@WAINGOR
Jul 28 2017 11:01
Hi all my brains just broke... How do I put the code below in an if statement? I want to execute a block of code IF the .some method returns true..How do I do this?
var someArray = ['kawai','schimmel','steinway'];
var check =  function(instrumentMerk){
                    return titlePlat.indexOf(instrumentMerk);
                }
so I wanna call .some on someArray with check as an argument
Markus Kiili
@Masd925
Jul 28 2017 11:06
@WAINGOR if(someArray.some(...)){...}
WAINGOR
@WAINGOR
Jul 28 2017 11:06
thanks @Masd925
CamperBot
@camperbot
Jul 28 2017 11:06
waingor sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4354 | @masd925 |http://www.freecodecamp.com/masd925
Stephen James
@sjames1958gm
Jul 28 2017 11:20
@WAINGOR your check function should probably compare indexOf to -1 if the goal is to return true/false if instrumentMerk is in titlePlat
WAINGOR
@WAINGOR
Jul 28 2017 11:21
I am affraid it is not working... I made some more specific code...So my goal is to see if ANY of the piano brands inside someArray are present in the string assigned to var titlePlat
//     maak string met pianomerk erin
var titlePlat = "this is a string witht the word kawai in it";
// maak testarray
var someArray = ['kawai','schimmel','steinway'];
var check =  function(pianoBrand){
                    return titlePlat.indexOf(instrumentMerk) >-1 ;
                }

var testFunc = function(array) {
if (array.some(check)) {
console.log("the array has at least 1 of the piano brands in it");
}
testFunc(someArray);
}
this should log to the console right? I see i have one curly bracket on th ewrong line here...
never mind
was due to bas syntax thanks @sjames1958gm
CamperBot
@camperbot
Jul 28 2017 11:24
waingor sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8178 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
WAINGOR
@WAINGOR
Jul 28 2017 11:25
bad*
WAINGOR
@WAINGOR
Jul 28 2017 11:34
say I was to use a map function. Would it be good practice to perform actions other than manipulating the current item during each iteration?
Stephen James
@sjames1958gm
Jul 28 2017 11:42
@WAINGOR I guess it depends, my preference is to only do mapping inside the map function
heroiczero
@heroiczero
Jul 28 2017 11:42
@WAINGOR map goes though each item in an array and performs the function
Markus Kiili
@Masd925
Jul 28 2017 11:43
@WAINGOR Map is for transforming array elements. Doing something else confuses the reader.
Darth Skywalker
@AdiSkywalker
Jul 28 2017 11:43
@WAINGOR map doesn't alter each item in place. It returns new array with modified items.
if you want to alter items in place, you could use .forEach instead of .map
heroiczero
@heroiczero
Jul 28 2017 11:44
@WAINGOR you could probably use a filter to get specific element from the array and perform an action on it
chenchaoquan
@xuan10000
Jul 28 2017 11:51

function multiplyAll(arr) {
var product = 1;
// 请把你的代码写在这条注释以下
for(var i=0;i<multiplyAll.length;i++){
for(var j=0;j<multiplyAll[i].length;j++){
product=product * multiplyAll[i][j];
}
}
// 请把你的代码写在这条注释以上
return product;
}

// 你可以修改这一行来测试你的代码
multiplyAll([[1,2],[3,4],[5,6,7]]);

没错啊
这题是不是出错了
heroiczero
@heroiczero
Jul 28 2017 11:52
@xuan10000 you want the arr.length and arr[i].length
Stephen James
@sjames1958gm
Jul 28 2017 11:57
@xuan10000 Your function should use arr (the array passed in) rather than multiplyAll the function name
chenchaoquan
@xuan10000
Jul 28 2017 12:03

function multiplyAll(arr) {
var product = 1;
// 请把你的代码写在这条注释以下
for (var i=0; i < arr.length; i++) {
for (var j=0; j < arr[i].length; j++) {
product*=arr[i][j];
}
}
// 请把你的代码写在这条注释以上
return product;
}

// 你可以修改这一行来测试你的代码
multiplyAll([[1,2],[3,4],[5,6,7]]);

ok
thanks
Stephen James
@sjames1958gm
Jul 28 2017 12:03
@xuan10000 :+1:
Owais Ahmed
@owaisehmed
Jul 28 2017 12:10
["HelLO", "hey"]
How to turn the first string in lowercase?]
Markus Kiili
@Masd925
Jul 28 2017 12:15
@owaisehmed You can access the array element, make a new lowercased string from it using string methods, and assign it back to the array element.
Sonja
@sonjaSch
Jul 28 2017 12:20

const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34];
// change code below this line
const squaredIntegers = realNumberArray.map((realNumberArray) =>{
   return Math.pow(realNumberArray,2);

}).filter((realNumberArray)=>{

  return squaredIntegers === (Number.isInteger(realNumberArray));
});
// change code above this line
// test your code
console.log(squaredIntegers);
hey guys I have some issues here;, i try to figure out to get just the integer values (I guess the filter par is nonsense :sweat_smile: )
Stephen James
@sjames1958gm
Jul 28 2017 12:22
@sonjaSch Your filter function parameter has confusing name. Your filter function probably want
(value) => { return value === Math.floor(value); }
@sonjaSch you are comparing a variable squareIntegers (which isn't even assigned a value yet, to a number from the map result array)
Sonja
@sonjaSch
Jul 28 2017 12:24
@sjames1958gm oh ok
@sjames1958gm thank u
CamperBot
@camperbot
Jul 28 2017 12:24
sonjasch sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8179 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Markus Kiili
@Masd925
Jul 28 2017 12:24
@sonjaSch Or return Number.isInteger(realNumberArray); if you just wan't to keep the integers.
Stephen James
@sjames1958gm
Jul 28 2017 12:25
@Masd925 I forgot about that function.
Sonja
@sonjaSch
Jul 28 2017 12:26
@sjames1958gm @Masd925 Math.floor() rounds the floatingpoint numbers right so that every number is an integer value then?!
Markus Kiili
@Masd925
Jul 28 2017 12:27
@sonjaSch There are many ways to check for number being an integer, but using a method that tells what you are doing is the clearest way.
Sonja
@sonjaSch
Jul 28 2017 12:28
@Masd925 :+1:
@Masd925 ty
CamperBot
@camperbot
Jul 28 2017 12:28
sonjasch sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4355 | @masd925 |http://www.freecodecamp.com/masd925
PortaX
@PortaX
Jul 28 2017 12:28
Help pls :) how can I get rid of the NaN produced by my code...

function reverseString(str) {
var backwards;
for(i = 5; i >= 0;--i){
backwards += str[i];
}
return backwards;
}

reverseString("hello");

It returns NaNolleh for example
teevik
@teevik
Jul 28 2017 12:30
Maybe var backwards = ""; helps
PortaX
@PortaX
Jul 28 2017 12:31
It returns undefinedolleh
Ronique Ricketts
@RoniqueRicketts
Jul 28 2017 12:31
@PortaX Please look at your loop again. what is the string is longer than 5 characters?
PortaX
@PortaX
Jul 28 2017 12:31
now
I don't seem to understand you question.. @RoniqueRicketts
teevik
@teevik
Jul 28 2017 12:32
Oh yeah, the loop is wrong too
PortaX
@PortaX
Jul 28 2017 12:32
Actually, changing the number to how long the word is and @teevik 's solution helps
For 5 letter words
Ronique Ricketts
@RoniqueRicketts
Jul 28 2017 12:32
PortaX
@PortaX
Jul 28 2017 12:32
What about this ?
Greetings from Earth
teevik
@teevik
Jul 28 2017 12:32
You probably shouldn't hardcode the length of the world
You can do .length on the string
Ronique Ricketts
@RoniqueRicketts
Jul 28 2017 12:33
@PortaX if the string is longer than 5 characters your code will not reverse the string.
In your loop your looping from 5 to 0, what is I wanted to reverse freecodecamp how would your loop reverse it?
PortaX
@PortaX
Jul 28 2017 12:34
@teevik That is genius, I'll try @RoniqueRicketts way too..
I understand :)
This works..
function reverseString(str) {
var backwards = "";
for(i = str.length -1 ; i >= 0;--i){
backwards += str[i];
}
return backwards;
}
reverseString("hello");
I'll try the other way now too.
Ronique Ricketts
@RoniqueRicketts
Jul 28 2017 12:36
@PortaX Also just a suggestion for the algorithms, check out the links that FCC offers for each algorithms. They help to point you in the right direction
PortaX
@PortaX
Jul 28 2017 12:37
Thank you guys :) @RoniqueRicketts @teevik
CamperBot
@camperbot
Jul 28 2017 12:37
portax sends brownie points to @roniquericketts and @teevik :sparkles: :thumbsup: :sparkles:
:cookie: 213 | @teevik |http://www.freecodecamp.com/teevik
:cookie: 312 | @roniquericketts |http://www.freecodecamp.com/roniquericketts
Ronique Ricketts
@RoniqueRicketts
Jul 28 2017 12:37
@PortaX good job!
PortaX
@PortaX
Jul 28 2017 12:37
@RoniqueRicketts I will.. I tried doing it on my own though, stretch those brain muscles haha
Ronique Ricketts
@RoniqueRicketts
Jul 28 2017 12:38
@PortaX well that works too. :) Keep going.
Ayush Mahajan
@ay2306
Jul 28 2017 12:44
hey guys can you help me here
I made a textbox
<input type='text' name='plea' id='plea'>
and then I made a division
<div id='dyn'></div>
Now i want to display what is written in #plea in #dyn using jquery, what should I do?
Ronique Ricketts
@RoniqueRicketts
Jul 28 2017 13:01
@ay2306 try
$("#plea").on("keyup", function(){
  var value = $( this ).val()
  $('#dyn').html(value);

});
Ayush Mahajan
@ay2306
Jul 28 2017 13:02
@RoniqueRicketts thank any idea on how to check if a radio button is selected or not?
<center>Gender: <label class='radio-inline gender_radio'><input type='radio' name='gender'>Male</label>    
                        <label class='radio-inline gender_radio'><input type='radio' name='gender'>Female</label></center>
CamperBot
@camperbot
Jul 28 2017 13:02
ay2306 sends brownie points to @roniquericketts :sparkles: :thumbsup: :sparkles:
:cookie: 313 | @roniquericketts |http://www.freecodecamp.com/roniquericketts
Stephen James
@sjames1958gm
Jul 28 2017 13:15
@ay2306 $("selector").prop("checked", true) You will need a unique selector
Darth Skywalker
@AdiSkywalker
Jul 28 2017 13:19
@ay2306 To see if radio / checkbox is selected, you can use $(selector).is(":checked")
ISU
@isu17
Jul 28 2017 13:22
guys
any good resources (besides the documentation of Vue) for learning Vue ?
Abhinav Mishra
@abhinav-m
Jul 28 2017 13:24
guys,
what are the use cases of box-sizing:border-box
do you generally apply it to all your divs?
is that a recommended thing?
mithun
@dmithun
Jul 28 2017 13:29
image.png
help me guys
Darth Skywalker
@AdiSkywalker
Jul 28 2017 13:29
@abhinav-thinktank First understand what is css box model and how box size is calculated (i.e what is included in size calculation), then read this
Abhinav Mishra
@abhinav-m
Jul 28 2017 13:30
i already know that.
Im asking if its a standard practice to do it on your html
Darth Skywalker
@AdiSkywalker
Jul 28 2017 13:30
@dmithun .push returns updated length of the string (which is a number) and you're calling .slice on Number
@dmithun scratch that.
my bad...
You are missing one closing bracket
@abhinav-thinktank - It's a vague question.
Stephen James
@sjames1958gm
Jul 28 2017 13:32
@dmithun You are slicing the output of push
Abhinav Mishra
@abhinav-m
Jul 28 2017 13:32
it really isn't...
@AdiSkywalker
Stephen James
@sjames1958gm
Jul 28 2017 13:35
@abhinav-thinktank Some experts recommend that web developers should consider routinely applying box-sizing: border-box to all elements.
https://css-tricks.com/international-box-sizing-awareness-day/
Abhinav Mishra
@abhinav-m
Jul 28 2017 13:35
@sjames1958gm aah yes!
thats what im talking about, but why is that done so
@sjames1958gm it's considered a best practice?
Stephen James
@sjames1958gm
Jul 28 2017 13:35
Some experts think so.
Abhinav Mishra
@abhinav-m
Jul 28 2017 13:36
*, *:before, *:after {
  box-sizing: border-box;
}
This is often called "universal box-sizing", and it's a good way to work!
@sjames1958gm do you do it where you work/ is it
Darth Skywalker
@AdiSkywalker
Jul 28 2017 13:37
We don't do it where I work... The reason is simple... Some places it's more appropriate to use padding-box or content-box
Stephen James
@sjames1958gm
Jul 28 2017 13:37
I don't do web development - I don't think there is a "right" answer I am sure there is reasons both way
Darth Skywalker
@AdiSkywalker
Jul 28 2017 13:37
over border box
What to use when depends on the level of responsiveness one wants to support
Abhinav Mishra
@abhinav-m
Jul 28 2017 13:38
@sjames1958gm i see. thanks!
CamperBot
@camperbot
Jul 28 2017 13:38
abhinav-thinktank sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8180 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jul 28 2017 13:39
That, for me is one of the biggest challenges learning this, there are few "RIGHT" answers.
Darth Skywalker
@AdiSkywalker
Jul 28 2017 13:40
right answers keep changing based on requirements :laughing:
Abhinav Mishra
@abhinav-m
Jul 28 2017 13:40
yea, i thought if im learning on my own, might as well pick up one of the best practices @sjames1958gm which is why i thought i'd ask around
it does reduce ambiguity in a sense
Kelechi Chinaka
@ke1echi
Jul 28 2017 13:42
That, for me is one of the biggest challenges learning this, there are few "RIGHT" answers.
u mean this keyword @sjames1958gm
Darth Skywalker
@AdiSkywalker
Jul 28 2017 13:42
:laughing:
mithun
@dmithun
Jul 28 2017 13:44
i'm confused what should i do now @AdiSkywalker @sjames1958gm ???????
Stephen James
@sjames1958gm
Jul 28 2017 13:44
@kelechy I meant web dev
Darth Skywalker
@AdiSkywalker
Jul 28 2017 13:45
@dmithun : First x.push(arr.slice(0,size));
Kelechi Chinaka
@ke1echi
Jul 28 2017 13:45
ok @sjames1958gm :wave: greetings
Stephen James
@sjames1958gm
Jul 28 2017 13:45
@dmithun I would rethink how your for loop is looping - you are looping size (which is the size of the chunks)
@kelechy :wave:
Darth Skywalker
@AdiSkywalker
Jul 28 2017 13:45
Now that you have right syntax, focus on fixing your logic here
mithun
@dmithun
Jul 28 2017 13:48
i have issue to understanding loops, any tips for solve this looping issue of mine???????
thankx @AdiSkywalker
CamperBot
@camperbot
Jul 28 2017 13:49
dmithun sends brownie points to @adiskywalker :sparkles: :thumbsup: :sparkles:
:cookie: 251 | @adiskywalker |http://www.freecodecamp.com/adiskywalker
Darth Skywalker
@AdiSkywalker
Jul 28 2017 13:49
@dmithun first you want to increment your i by size not by one (that's the simplest way, I assume)
and then you want to adjust the parameters you pass to slice to be dependent on value of i
mithun
@dmithun
Jul 28 2017 13:51
no i meant to say that, how do i improve my looping???????
Darth Skywalker
@AdiSkywalker
Jul 28 2017 13:55
@dmithun What @sjames1958gm meant by improving your loop is you can either increment i by size (i+=size instead of i++) or, change your i<size condition (like i<Math.ceil(arr.length/size)
Blauelf
@Blauelf
Jul 28 2017 13:56
Have your loop run arr.length/size times, rounded up. This can be achieved in multiple ways, I'd recommend the one @AdiSkywalker described, changing the increment.
@AdiSkywalker For i++, i < arr.length/size would work, too (as i is always integer, the < stays the same whether you Math.ceil or not)
Darth Skywalker
@AdiSkywalker
Jul 28 2017 13:57
right! :+1: @Blauelf
I forgot to mention "keep your i++ as it is" in 2nd part
mithun
@dmithun
Jul 28 2017 14:13
thankx @AdiSkywalker @sjames1958gm @Blauelf
CamperBot
@camperbot
Jul 28 2017 14:13
dmithun sends brownie points to @adiskywalker and @sjames1958gm and @blauelf :sparkles: :thumbsup: :sparkles:
:warning: dmithun already gave adiskywalker points
:star2: 4543 | @blauelf |http://www.freecodecamp.com/blauelf
:star2: 8181 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Diego Mayer
@Chrono79
Jul 28 2017 14:35
Hi, can anybody else confirm this problem? When I use shift+r or shift+s in the input field in the challenge React 30 Reload Seed or Solution Code is executed: http://hysterical-amusement.surge.sh/
It's like a shortcut is set, and it's ignoring that the focus is on the input
I can use caps or paste the capital R or S, but fixing it seems less annoying
Pieter Stokkink
@forkerino
Jul 28 2017 14:38
@Chrono79 I can't reproduce the problem.
Diego Mayer
@Chrono79
Jul 28 2017 14:38
it's weird, it happens to me both at work and at home (I use Chrome if that helps)
odm275
@odm275
Jul 28 2017 14:42

$("#myBtn").click(function(){
//write funtion that generates random color and sticks it to the background per click;
var r = Math.floor((Math.random() 256));
var g = Math.floor((Math.random()
256));
var b = Math.floor((Math.random() * 256));
console.log(r,g,b);
var color = 'rgb'+'('+r+','+g+','+b+')';
console.log(color);
document.getElementById("body").style.color = color;

I'm trying to change my background color for every click, anyone know why it is not working?

i click, and nothing happens :s
teevik
@teevik
Jul 28 2017 14:43
Math.random() 256
odm275
@odm275
Jul 28 2017 14:45
?
Blauelf
@Blauelf
Jul 28 2017 14:46
@Chrono79 For me, Shift+R and Shift+S trigger those actions only when I'm not in the text field. Firefox and Chrome.
Diego Mayer
@Chrono79
Jul 28 2017 14:47
@Blauelf damn, I must be cursed then
@forkerino told me it happens to him too, I'm not that crazy then
@odm275 document.getElementById("body") body has that id?
Blauelf
@Blauelf
Jul 28 2017 14:55

@odm275

  1. document.body instead of document.getElementById("body")
  2. backgroundColor instead of color (which is foreground colour, for example used for text)

This would work (was too lazy to load jQuery, so vanilla JS):

document.getElementById("myBtn").addEventListener("click", function(){
    //write funtion that generates random color and sticks it to the background per click;
    var r = Math.floor((Math.random() * 256));
    var g = Math.floor((Math.random() * 256));
    var b = Math.floor((Math.random() * 256));
    console.log(r,g,b);
    var color = 'rgb'+'('+r+','+g+','+b+')';
    console.log(color);
    document.body.style.backgroundColor = color;
});
Diego Mayer
@Chrono79
Jul 28 2017 14:59
if you already use jQuery, you could as well use it to change the color like this: $('body').css('background-color', color);
Blauelf
@Blauelf
Jul 28 2017 14:59
Another way to generate a random colour is var color = '#' + Math.random().toString(16).slice(-7,-1); (not sure how evenly these digits are distributed)
It's so weird they used - in CSS property names. Those spaces in calc (like in calc(50% - 5px)) needed just because otherwise that - could be part of a name look really ugly.
Blauelf
@Blauelf
Jul 28 2017 15:05
And I still want colour to be an alias for color, like grey and gray both work the same on a colour attribute. But no, not for property names.
Christopher McCormack
@cmccormack
Jul 28 2017 15:21
The little work I did with color I enjoyed using hsla, as it allowed you to keep a similar pallet and just change the hue
also :wave: good morning
Blauelf
@Blauelf
Jul 28 2017 15:22
Good afternoon :D
Jason Luboff
@JLuboff
Jul 28 2017 15:23
Mornign
Blauelf
@Blauelf
Jul 28 2017 15:23
hsla is hsl with an alpha, like rgba to rgb?
Diego Mayer
@Chrono79
Jul 28 2017 15:26
:wave:
Christopher McCormack
@cmccormack
Jul 28 2017 15:29
@Blauelf yeah I think so
I did something like this to make a bunch of canvas objects all with a very similar look
color = 'hsla(' + Math.floor(Math.random() * 255) + ',60%,60%,0.9)'
not sure if it's supported in all browsers though
Blauelf
@Blauelf
Jul 28 2017 15:31
@cmccormack Support looks great for the biggest part. Support since IE9. http://caniuse.com/#feat=css3-colors
Though I'm always worried about IE and transparency, I think I remember some bug with transparent PNGs. Or not so transparent.
Christopher McCormack
@cmccormack
Jul 28 2017 15:33
People still using IE?
dang
Jason Luboff
@JLuboff
Jul 28 2017 15:34
Unfortunately...
Blauelf
@Blauelf
Jul 28 2017 15:36
@cmccormack I would not believe it if there weren't customers complaining about our new paging being broken on IE. Some script triggers that will keep scrolling to the top as soon as you scroll down on the second page. But only for IE.
Christopher McCormack
@cmccormack
Jul 28 2017 15:38
wonderful haha
so you have to program in a bunch of IE only code I imagine?
Blauelf
@Blauelf
Jul 28 2017 15:38
Weird thing is that IE is mostly deprecated, and Microsoft keeps saying "Use Edge!" (how would I on Windows NT 6.1 AKA Windows 7?)
Jason Luboff
@JLuboff
Jul 28 2017 15:39
Edge works well most of the time...but still has some compat issues
Christopher McCormack
@cmccormack
Jul 28 2017 15:39
Aren't they deprecating windows 7 soon?
Blauelf
@Blauelf
Jul 28 2017 15:39
It's like "We no fixing our programs. You go Ten."
Win7 will get security updates till 2020 (and 8.1 will retire shortly after)
Christopher McCormack
@cmccormack
Jul 28 2017 15:40
I guess that gives time for enterprise to update to windows 10 on asset refresh every 3-5 years
I think we just started the beta for win 10, slow adoption in enterprise that's for sure
Joseph
@revisualize
Jul 28 2017 15:43
We're already moving everything to Win 10 Ent with Bitlocker
Jason Luboff
@JLuboff
Jul 28 2017 15:43
We just started purchasing Windows 10 machines a year ago (I got the first one!). Since then, we've only upgraded as needed... ~18 computers total of... ~150-200?
Blauelf
@Blauelf
Jul 28 2017 15:43
I guess there are still many 2000/XP computers in universities, sold with expensive devices. Those don't get upgrades to new operating systems, as there's no guarantee the device will run at all. We were lucky, the software was still in development and got adapted to Windows 7 and its different driver signing preferences.
Christopher McCormack
@cmccormack
Jul 28 2017 15:44
I just hope those 2k/xp machines aren't connected to the internet
Blauelf
@Blauelf
Jul 28 2017 15:45
They are connected to internal networks, which are connected to the internet. Though they are not used for browsing, they probably could be.
You don't want to transfer your high-resolution microscopic images on DVDs only.
You can imagine how nervous they get every time a new ransomware goes around.
Christopher McCormack
@cmccormack
Jul 28 2017 15:47
I dunno - we've been pushing that more and more lately as data requirements get bigger and bigger. Want to transfer terabytes across the world? That will take days even with high speed connections because of TCP and the speed of light. Faster solution? FedEx the hard drive
I wonder if ransomware authors have thought to target older OSs. Smaller footprint but potentially larger payouts
@JLuboff do you have a lot of group policy? I imagine our heavy use of it is what's slowing the testing
Blauelf
@Blauelf
Jul 28 2017 15:49
There once was the race between a lot of glass fibre and carrier pigeon (carrying a micro-SD). The bird won.
Christopher McCormack
@cmccormack
Jul 28 2017 15:50
maybe we can start our own Trebuchet ISP
Blauelf
@Blauelf
Jul 28 2017 15:50
Microsoft fixed a few bugs in Windows XP lately, they must have expected a large wave of ransomware if they didn't.
Christopher McCormack
@cmccormack
Jul 28 2017 15:52
Software is hard. I hoped abstractions like Java would help avoid this type of legacy software dependency but I guess it's up to the original software engineers to think that far ahead
plus I guess you need the VM that can still run that software to be compatable on newer OS as well
Blauelf
@Blauelf
Jul 28 2017 15:53
ATM and similar devices often run XP, or don't get updates. German railway had funny issues with displays, see for example https://www.google.de/search?q=deutsche+bahn+ransomware&tbm=isch
Abstractions like Java? I don't see how Java would help. We just split the bugs.
Jason Luboff
@JLuboff
Jul 28 2017 15:55
@cmccormack We have very minimal GP...like...barely any. I've never gone in to look but I think its really just password policy and maybe one or two other things :worried:
Christopher McCormack
@cmccormack
Jul 28 2017 15:55
Java VM can be upgraded to run on modern OS while still running old bytecode
Blauelf
@Blauelf
Jul 28 2017 15:55
And Java and HTTPS is always fun. Podcast guys with wrong certificates (not one of the pre-installed CAs) would not migrate to HTTPS for that reason.
Christopher McCormack
@cmccormack
Jul 28 2017 15:57
@JLuboff you should see if there is anything in there that will help prevent phishing :D
@Blauelf I bet, wasn't saying Java was the answer, just that I hoped something like it would be the panacea for legacy software
Jason Luboff
@JLuboff
Jul 28 2017 15:57
Ya probably not a bad idea
Blauelf
@Blauelf
Jul 28 2017 15:57
@cmccormack JVM can be upgraded within one version. New version might introduce breaking changes (we had some when over a weekend an API provider upgraded their version - and HTTPS broke because of non-matching versions)
We have emails "Don't trust emails saying you should transfer money and not tell anybody". I wonder why they need to warn.
Christopher McCormack
@cmccormack
Jul 28 2017 16:00
@Blauelf HAHA most people are dangerous with a computer I guess
Stephen James
@sjames1958gm
Jul 28 2017 16:00
My mom is always worried about viruses. I just tell here, NEVER NEVER click a link in an email.
For her, and most that is sufficient.
Jason Luboff
@JLuboff
Jul 28 2017 16:01
We've debated changing all emails to plaintext...
Christopher McCormack
@cmccormack
Jul 28 2017 16:02
@JLuboff a lot of enterprises do just that
@sjames1958gm agreed - it just needs to be drilled over and over so the user recognizes what they see as malicious
Jason Luboff
@JLuboff
Jul 28 2017 16:02
@cmccormack The backlash would be...not plesant
Christopher McCormack
@cmccormack
Jul 28 2017 16:03
or just treat everything as malicious
@JLuboff do you use Exchange?
Jason Luboff
@JLuboff
Jul 28 2017 16:03
Office 365, so ya
Christopher McCormack
@cmccormack
Jul 28 2017 16:04
There should be a way to setup email accounts/domains as trusted senders and that gets attached to e-mails from that group. Not sure how though, I just know we implemented that a while back
Blauelf
@Blauelf
Jul 28 2017 16:05
@JLuboff We have Lotus Notes on Citrix. And for me, IE on Citrix is broken (no proxy). I appreciate it, as Lotus Notes would not give me the address of a link unless I open it in IE.
Jason Luboff
@JLuboff
Jul 28 2017 16:05
@cmccormack Ya, thats probably not difficult to setup
@Blauelf I didn't even know Lotus Notes was still around..
Christopher McCormack
@cmccormack
Jul 28 2017 16:06
holy cow you still use Lotus Notes??
Blauelf
@Blauelf
Jul 28 2017 16:06
It is. Some of us have a newer version, IBM Notes.
Jason Luboff
@JLuboff
Jul 28 2017 16:06
Jesus..
Christopher McCormack
@cmccormack
Jul 28 2017 16:06
Lotus was interesting but it was so bloated and out of touch with modern tools back when I was using it
Jason Luboff
@JLuboff
Jul 28 2017 16:07
I never formally used it, but had seen it
Blauelf
@Blauelf
Jul 28 2017 16:07
It's used for many workflows, with some custom code. And it has great offline/sync capabilities.
I don't use it offline (how should I, when the Citrix is offline, I would not get into Notes)
Christopher McCormack
@cmccormack
Jul 28 2017 16:10
The databases were pretty interesting but we replaced that functionality with SharePoint and I wouldn't look back
not that I'm a huge SharePoint fan either but at least it's not as cumbersome
GeorgeII
@GeorgeII
Jul 28 2017 16:10
Why does my code create a new block only once? It's supposed to be implemented every 1 sec
function addBlueContainer() {
  $("#upper-bar").prepend('<div class="blue-container"></div>');
}
var ti = setTimeout(addBlueContainer, 1000);
Christopher McCormack
@cmccormack
Jul 28 2017 16:11
@GeorgeII use setInterval
GeorgeII
@GeorgeII
Jul 28 2017 16:12
@cmccormack I have tried it
but now it works
@cmccormack ty
CamperBot
@camperbot
Jul 28 2017 16:12
georgeii sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1069 | @cmccormack |http://www.freecodecamp.com/cmccormack
Christopher McCormack
@cmccormack
Jul 28 2017 16:12
@GeorgeII np
GeorgeII
@GeorgeII
Jul 28 2017 16:13
@cmccormack is there any function to stop setInterval?
I need to break it after 20 blocks have been created
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:14
@GeorgeII Yes. In your addBlueContainer function if you do clearInterval(ti) it will stop the interval
Example
var count = 0;
function addBlueContainer() {
  if(count++ > 20){
    clearInterval(ti);
  }
  $("#upper-bar").prepend('<div class="blue-container"></div>');
}
var ti = setInterval(addBlueContainer, 1000);
Blauelf
@Blauelf
Jul 28 2017 16:17
@AdiSkywalker I guess it should be if (++count >= 20) for exactly 20.
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:17
right! :+1: @Blauelf
Blauelf
@Blauelf
Jul 28 2017 16:18
Your solution creates 22.
GeorgeII
@GeorgeII
Jul 28 2017 16:18
@AdiSkywalker ty
CamperBot
@camperbot
Jul 28 2017 16:18
georgeii sends brownie points to @adiskywalker :sparkles: :thumbsup: :sparkles:
:cookie: 255 | @adiskywalker |http://www.freecodecamp.com/adiskywalker
Blauelf
@Blauelf
Jul 28 2017 16:21
Reminds me that I should tackle the projects. The tomato-shaped kitchen timer ("pomodoro", as it was an Italian guy who named the method) makes heavy use of intervals, and clearInterval, and stuff, and if you do it wrong, double-clicking leaves you with a non-clearable interval. Should be fun. The HTML/CSS around... maybe fun for others.
GeorgeII
@GeorgeII
Jul 28 2017 16:21
function addBlueContainer() {
  if ($(".blue-container").length > 19)) {
    clearInterval(ti);
  }
  $("#upper-bar").prepend('<div class="blue-container"></div>');
}
var ti = setInterval(addBlueContainer, 1000);
what's wrong here?
Blauelf
@Blauelf
Jul 28 2017 16:23
You mean you get 21 elements? Swap prepend and the if (first prepend, then count them). Or is it wrong in another way?
GeorgeII
@GeorgeII
Jul 28 2017 16:24
it does not work at all
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:24
@Blauelf Yeah... It should be if(++count > 19){
Blauelf
@Blauelf
Jul 28 2017 16:25
Or if(++count >= 20). And it could be different if you did it at the end of the function, after adding an element.
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:27
@GeorgeII : Syntax error in your code... Extra closing bracket in if ($(".blue-container").length > 19)) {
should be if ($(".blue-container").length > 19) {
GeorgeII
@GeorgeII
Jul 28 2017 16:28
@AdiSkywalker oh ty
CamperBot
@camperbot
Jul 28 2017 16:28
georgeii sends brownie points to @adiskywalker :sparkles: :thumbsup: :sparkles:
:warning: georgeii already gave adiskywalker points
GeorgeII
@GeorgeII
Jul 28 2017 16:28
that's the kind of a stupid mistake
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:29
@GeorgeII Happens :)
Jason Luboff
@JLuboff
Jul 28 2017 16:30
@Blauelf I hated the pomodoro project. That and Simon. Tic-tac-toe was fun and the calculator was alright (even if mine does technically still have some issues)
Keon Samuel
@keonsam
Jul 28 2017 16:30
anyone tried webAssembly?
Christopher McCormack
@cmccormack
Jul 28 2017 16:31
Man calculator... That one was tough only because of the way javascript parses numbers. If you wanted it to be both fairly accurate and look good you had to fuss with it a lot
Blauelf
@Blauelf
Jul 28 2017 16:31
@JLuboff In my opinion, Simon is harder. I have no idea how the game is meant to react if I for example hit it while it's still playing a sequence, or if I don't do anything for a minute (should it stand still? repeat its sequence?)
Jason Luboff
@JLuboff
Jul 28 2017 16:32
I don't think I accounted for the player hitting it prior to the sequence completion. And after the sequence, it just waits
Christopher McCormack
@cmccormack
Jul 28 2017 16:32
That's why I just disabled input during the computer turn on both simon and tic tac toe :D
Blauelf
@Blauelf
Jul 28 2017 16:32
@cmccormack If that calculator was using Reverse Polish Notation, I'd love it.
Christopher McCormack
@cmccormack
Jul 28 2017 16:33
@Blauelf mine actually was at first because I implemented it backwards haha
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:33

@GeorgeII : On a side note, I'd refrain from creating new elements this way..

$("#upper-bar").prepend('<div class="blue-container"></div>');

My recommended alternative is as follows

var count = 0;
var ti, $blueContainer, $upperBar;

$(document).ready(function() {
  $blueContainer = $("<div/>", {
    class: "blue-container"
  });
  $upperBar = $("#upper-bar");
  ti = setInterval(addBlueContainer, 100);
});

function addBlueContainer() {
  if (++count >= 20) {
    clearInterval(ti);
  }
  $upperBar.prepend($blueContainer.clone());
}
Blauelf
@Blauelf
Jul 28 2017 16:34
But Reverse Polish Notation is like 7 Enter 6 Enter x => 42 (no Enter key on regular calculator)
Jason Luboff
@JLuboff
Jul 28 2017 16:34
RPN seems...odd
Obiviousily since I'm not used to it
Blauelf
@Blauelf
Jul 28 2017 16:35
It's great. You don't need any parentheses, and can still do anything.
Christopher McCormack
@cmccormack
Jul 28 2017 16:35
@Blauelf eh it was similar
Blauelf
@Blauelf
Jul 28 2017 16:35
Stack based.
Christopher McCormack
@cmccormack
Jul 28 2017 16:35
we had to use it in a physics or math class, can't remember - it was actually pretty nice
Joel Y.
@zapcannon99
Jul 28 2017 16:36
RPN rules
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:36
I remember when I did calculator, I allowed users to enter whole arithmetic expression and used eval to calculate result
no need of stack or to learn operator precedence
Christopher McCormack
@cmccormack
Jul 28 2017 16:36
@AdiSkywalker I specifically avoided that in mine even though I think the example used the same method
Blauelf
@Blauelf
Jul 28 2017 16:37
eval is evil >:]
Christopher McCormack
@cmccormack
Jul 28 2017 16:37
eval is dangerous so I try to avoid it all times
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:37
I see. I don't know what the example used. But it's always good to implement precedence handler on your own (for the sake of learning)
WAINGOR
@WAINGOR
Jul 28 2017 16:37
Hi guys. Does anybody here use node with cheerio?
Blauelf
@Blauelf
Jul 28 2017 16:37
The example calculator is far from perfect. I found an easy sequence where it would behave in an odd way.
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:38
@WAINGOR I used it's alternative called jsdom
@WAINGOR but why would you want to do something like that on server?
Jason Luboff
@JLuboff
Jul 28 2017 16:38
I used eval as well even though I know it has its issues, but in the simple calculator arrangement, I don't think it would have any security flaw
GeorgeII
@GeorgeII
Jul 28 2017 16:38
@AdiSkywalker is it faster or just a good form?
Blauelf
@Blauelf
Jul 28 2017 16:38
@AdiSkywalker "its", not "it's"
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:39
@Blauelf oops... sorry.. I'm not native English :laughing:
WAINGOR
@WAINGOR
Jul 28 2017 16:39
crawling. I have a question. I logged an element that I selected with cheerio and it give me an object. Then again, when I log another element it gives me plain HTML
@AdiSkywalker
U know why this is?\
Blauelf
@Blauelf
Jul 28 2017 16:39
@AdiSkywalker Me neither. And here in Germany, people tend to add apostrophes to anything, which makes me really angry, as it makes no sense.
@AdiSkywalker But "it's" is short for "it is", while "its" is the possessive pronoun, like "his" or "her".
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:41
@GeorgeII It is a lot more maintainable .Imagine you create a lot of elements using string and you want to change placement of them... String manipulation becomes pain in the ass as the code grows.
@Blauelf aww... Thanks for clarification :)
CamperBot
@camperbot
Jul 28 2017 16:41
adiskywalker sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4544 | @blauelf |http://www.freecodecamp.com/blauelf
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:42
@WAINGOR I see.. Can you show me your code?
Assuming its (is this correct @Blauelf ? ) in standard format
Blauelf
@Blauelf
Jul 28 2017 16:44
@AdiSkywalker "its" is like "his" or "her", while "it's" is short for "it is". The apostrophe marks the space where letters went missing. Like "they are" => "they're" (not to be confused with "their" or "there")
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:44
Oh!
Blauelf
@Blauelf
Jul 28 2017 16:45
Homophones FTW :P
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:45
haha
new and knew
made maid
Blauelf
@Blauelf
Jul 28 2017 16:46
night and knight, yes, that kind.
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:46
male mail
I got an emale!
Gender : Mail
Blauelf
@Blauelf
Jul 28 2017 16:46
Electrified your member?
Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:46
:P
GeorgeII
@GeorgeII
Jul 28 2017 16:46
@AdiSkywalker got it
WAINGOR
@WAINGOR
Jul 28 2017 16:46

@AdiSkywalker I found out why. It seems that when I log

            var cellGroup = $(".cell-group");

it give me plain HTML. As soon as I loop through the elemests with this classnames using .each it returns an object.... idk why

Darth Skywalker
@AdiSkywalker
Jul 28 2017 16:47
@GeorgeII :+1:
@WAINGOR : I see.. May be that's how it works then?
Christopher McCormack
@cmccormack
Jul 28 2017 16:56
@WAINGOR are you sure it gives you plain html? I believe var cellGroup = $(".cell-group"); should give you a jquery collection of elements, and .each will give you the actual element. $ IS jQuery in this instance correct?
Kelechi Chinaka
@ke1echi
Jul 28 2017 16:57
Note: the decryption should be left shift; Shift is only for uppercase and lowercase letters, other characters will remain the same; The shift mode is a cyclic shift, for example: ``` character "A" after decryption should be "X" instead of ">"
String.fromCharCode('A'.charCodeAt()<<3)
i tried this but not working
Christopher McCormack
@cmccormack
Jul 28 2017 16:58
@kelechy what are you doing? why would you bitshift a char?
that's going to give you a huge number, as your shifting the binary value of A left three bits which is equivalent to multiplying the value of A by 2**3
Kelechi Chinaka
@ke1echi
Jul 28 2017 17:00
ok
is there a workaround to egtting the output
*getting
Christopher McCormack
@cmccormack
Jul 28 2017 17:00
what project are you working on, Caesar's Cipher?
Kelechi Chinaka
@ke1echi
Jul 28 2017 17:01
CW
Darth Skywalker
@AdiSkywalker
Jul 28 2017 17:04
@cmccormack He's using Cheerio, a library to manipulate html markup on the server side
which doesn't run in browser
Christopher McCormack
@cmccormack
Jul 28 2017 17:06

@kelechy ok well it looks like you're doing a Caesar's Cipher - what you need to do is check if the value of the character plus or minus the offset is greater than or less than the range of alpha characters. If so, then you need to wrap back around. So if 'A' is 97 and you subtract 3, you'll get > because you're now outside the range of uppercase alpha. If you add 26 to the result when less than 97, you should get 'X'.

> String.fromCharCode('A'.charCodeAt() - 3)
'>'
> String.fromCharCode('A'.charCodeAt() - 3 + 26)
'X'

You can use conditionals to determine if the resulting value after calculating the offset is outside your range first to determine if you need to add/subtract 26

Kelechi Chinaka
@ke1echi
Jul 28 2017 17:09
thanks @cmccormack i would refactor now
CamperBot
@camperbot
Jul 28 2017 17:09
kelechy sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1070 | @cmccormack |http://www.freecodecamp.com/cmccormack
Christopher McCormack
@cmccormack
Jul 28 2017 17:09
@kelechy gl
Kelechi Chinaka
@ke1echi
Jul 28 2017 17:14
what do u mean by offset @cmccormack
Christopher McCormack
@cmccormack
Jul 28 2017 17:17
@kelechy in your example 3 is the offset/shift value
Kelechi Chinaka
@ke1echi
Jul 28 2017 17:19
ok..need to set the logic @cmccormack :smile:
Christopher McCormack
@cmccormack
Jul 28 2017 17:20
You'd have to adjust the pseudocode to account for the character offsets from 0, but not too challenging
aRtoo
@artoodeeto
Jul 28 2017 17:27
hi guys. need help about my search input on the twitch app im making a live search and keyup event is doing good. but when i press a key it will pass the value to the url so it will return every keyup that i press. heres the codepen. hope you can help. thanks. https://codepen.io/artoo/pen/YxPOWP
Blauelf
@Blauelf
Jul 28 2017 17:31
@artoodeeto You mean you want to debounce the keys?
aRtoo
@artoodeeto
Jul 28 2017 17:32
@Blauelf i dont know what your talking about bro but try inputing freecodecamp itll return all the keys and it will display something
Blauelf
@Blauelf
Jul 28 2017 17:34
That's what I mean with debounce. Debounce means you'll wait for the user to stop typing for a moment (or something similar) before doing the request.
Blauelf
@Blauelf
Jul 28 2017 18:00

One way is to encapsulate your callback, like

function debounce(fun, delay) {
  var handle;
  return function() {
    clearTimeout(handle);
    handle = setTimeout(Function.prototype.bind.apply(fun, [this].concat(arguments)), delay || 200); // default of 200ms
  }
}

$("#myInput").on("keyup", debounce(myKeyupHandler, 500)); // call the handler after 500ms, new events delay it further

For a slow API, you could also wait for the last request to complete, or something like that. Depending on what you want, any method has its pros and cons.

I once saw Function.prototype.bind.apply (in disguise), and did not really understand what it did, or at least it took me a while. And now I'm using it as if it were the most basic thing. I'm scared. :worried:
omarraza
@omarraza
Jul 28 2017 18:07
Smallest Common Multiple. I'm a bit stuck, its been awhile so i'm rusty
function smallestCommons(arr) {
  var range = [];
  var arg1 = arguments[0][0];
  var arg2 = arguments[0][1];
  var product;
  var x;

  //ordering the arguments largest to smallest
  if (arg1 < arg2){
    arg1 = arguments[0][1];
    arg2 = arguments[0][0];
  }
  //pushing the range into an array
  for (var i = arg1; i >= arg2; i--){
    range.push(i);
  }

  x = range[1];

  while (true){
  product = range[0] * x;
    for (var j = 1; j < range.length; j++){
      if (product % range[j] !== 0){
       break;
      }
      else{
        return product;
      }
     }
   x++;
    }
  }


smallestCommons([1,5]);
The problem is with my while loop. I'm exiting it too soon. So in the [1,5] case I return 20 instead of 60
Christopher McCormack
@cmccormack
Jul 28 2017 18:07
@omarraza no need to use arguments, you can just use arr[0], arr[1]
omarraza
@omarraza
Jul 28 2017 18:10
@cmccormack gotcha
Christopher McCormack
@cmccormack
Jul 28 2017 18:10
@omarraza sorry you have this broken up into a lot of confusing pieces so I'm still reviewing
maybe look at the array sort method as well to clean up some of the code
Blauelf
@Blauelf
Jul 28 2017 18:12
@omarraza You could try else if (j + 1 === range.length) { return product; } (though that looks more like an ugly hack)
Bradley Sands
@sandsbe
Jul 28 2017 18:15
In Firefox dev tools, does anyone know how to close the filter bar & section next to the Scratchpad? It opened when I selected Inspect.
image.png
omarraza
@omarraza
Jul 28 2017 18:16
@Blauelf you're a genius. I'm still digesting that in my mind, and it worked. Thank you
CamperBot
@camperbot
Jul 28 2017 18:16
omarraza sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4545 | @blauelf |http://www.freecodecamp.com/blauelf
Blauelf
@Blauelf
Jul 28 2017 18:19
@sandsbe Escape key worked for me.
@omarraza That if restricts the action to the last iteration only. I'd prefer a different layout, but I also prefer usage of the greatest common divisor when calculating the least common multiple.
Bradley Sands
@sandsbe
Jul 28 2017 18:23
@Blauelf ty. That did work. It also closed out the console, but that I could just easily open up. This 3 screen dev tools setup is new to me and has been extremely helpful.
CamperBot
@camperbot
Jul 28 2017 18:23
sandsbe sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4546 | @blauelf |http://www.freecodecamp.com/blauelf
Blauelf
@Blauelf
Jul 28 2017 18:24
From the dark theme, you're on firefox dev edition.
Ah, current release version also knows dark theme. I still do miss Firebug :/
Bradley Sands
@sandsbe
Jul 28 2017 18:26
So, I'm following along on PluralSight. Not too bad, has at least taught me a different way to use Firefox. But my theme doesn't match the instructor. Searching for Firefox dev tools themes has resulted in Nada. Could be better...
Blauelf
@Blauelf
Jul 28 2017 18:27
There are three, I think. Dark, light, and Firebug.
Bradley Sands
@sandsbe
Jul 28 2017 18:28
Firebug is awful close to Dark.
I meant Light.
Blauelf
@Blauelf
Jul 28 2017 18:28
Current dev tools are based on Firebug extension. So that one is for nostalgia only.
aRtoo
@artoodeeto
Jul 28 2017 18:29
hi guys. any idea how .hide(); work?? i cant hide class card on my js. heres the codepen. https://codepen.io/artoo/pen/YxPOWP
Christopher McCormack
@cmccormack
Jul 28 2017 18:35
@artoodeeto did you save?
aRtoo
@artoodeeto
Jul 28 2017 18:35
@cmccormack save what bro??
Christopher McCormack
@cmccormack
Jul 28 2017 18:36
your codepen, I don't see .hide in your js anywhere
Bradley Sands
@sandsbe
Jul 28 2017 18:36
is .hide a standard class in Bootstrap?
Christopher McCormack
@cmccormack
Jul 28 2017 18:39
don't think so but hidden is an attribute you can add to an element as well as display: none; in CSS style
Jason Luboff
@JLuboff
Jul 28 2017 18:40
.hidden is the class in bootstrap I believe
I'm liking using Bulma CSS. Little more difficult at times then bootstrap, but I like the overall feel/look of things
Christopher McCormack
@cmccormack
Jul 28 2017 18:41
@artoodeeto if your object is a jquery object hide() and show() should work just fine
aRtoo
@artoodeeto
Jul 28 2017 18:43
@cmccormack tried hide doesnt work bro.
Christopher McCormack
@cmccormack
Jul 28 2017 18:44
@artoodeeto very hard to help you troubleshoot when you remove the method. Add it back, save it, and we can look at it with you
Jason Luboff
@JLuboff
Jul 28 2017 18:49
https://nightlife-app.glitch.me/ Using Bulma CSS (Note: This is a work in progress. Still a lot to do. If you search, hit submit, not enter)
Oh, and the login won't work currently
Now the login will work
aRtoo
@artoodeeto
Jul 28 2017 18:55
@cmccormack heres the pen sir. https://codepen.io/artoo/pen/YxPOWP
Christopher McCormack
@cmccormack
Jul 28 2017 19:07
@artoodeeto it looks to me like you're hiding then adding brand new cards
aRtoo
@artoodeeto
Jul 28 2017 19:10

@cmccormack yea dont mind the offline and online button. the all-btn should hide the previous data and post the new one. i added this code

  $('.all-btn').on('click', function() {
        $('.card').hide();
        for(var i=0; i<userArr.length; i++){
            userData(userArr[i]);
        }
      });

i should hide the previous data.yes it hides but it will repopulate again

Christopher McCormack
@cmccormack
Jul 28 2017 19:12
you're rebuilding html from the stored string
which means hiding it will be irrelevent
Instead, why not keep all elements on the page after you load them, but add an identifier to each that specifies if it's online or offline, then use jquery to show/hide based on those identifiers
aRtoo
@artoodeeto
Jul 28 2017 19:14
@cmccormack so what do you suggest sir?
Christopher McCormack
@cmccormack
Jul 28 2017 19:15
It can be a class or a data-* attribute or whatever you choose, but the elements will always be in the DOM and you can manipulate visibility from there.
This is ignoring your search functionality at the moment, of course
search you will need to make sure you append a new element including the identifiers so jquery can act on those as well
Alex Schiffer
@alexjschiffer
Jul 28 2017 19:42
Can anyone tell me why I can't access my alert? The winner function returns true or false.
function endGame(xwins, owins) {
      var xwins = winner('x');
      var owins = winner('o');
      alert('end game activated');
      if (xwins) {
        // stop the game
        currentPlayer = "none";
        $title.text("Player X Wins!!!");
      }
      if (owins) {
        // stop the game
        currentPlayer = "none";
        $title.text("Player O Wins!!!");
      }
    }
Stephen James
@sjames1958gm
Jul 28 2017 19:45
@alexjschiffer What is $title?
Alex Schiffer
@alexjschiffer
Jul 28 2017 19:46
@sjames1958gm its just a variable that holds $('#title')
Stephen James
@sjames1958gm
Jul 28 2017 19:46
@alexjschiffer Ok, then what do you mean by access my alert?
Austin Wiggins
@austinwiggins
Jul 28 2017 19:48
Hey, could anyone here help me make a button that switches fahrenheit to celsius and vice versa? Any help would be very appreciated
I've got everything else figured out, all I need is that, as you can see here:https://codepen.io/bigwigaustin/pen/vZxJeP
Alex Schiffer
@alexjschiffer
Jul 28 2017 19:49
@sjames1958gm Line number for is an alert, but it never actually runs. The second line is stopping the rest of the function from running i think.
Stephen James
@sjames1958gm
Jul 28 2017 19:50
@alexjschiffer Do you have an infinite loop if there is no win? Hard to tell with just this code :(
Ankur sharma
@ankur1163
Jul 28 2017 19:50
how do you guys master bootstrap ?
Alex Schiffer
@alexjschiffer
Jul 28 2017 19:51
@sjames1958gm The game plays fine, but it just never has an end... https://codepen.io/bioalex/pen/vJEpWK
Stephen James
@sjames1958gm
Jul 28 2017 19:51
@austinwiggins Store the temperature "globally" and put a click handler on that button, converting and updating the temperature display
Kelechi Chinaka
@ke1echi
Jul 28 2017 19:52
master bootstarp? @ankur1163 sounds strange to me :smile:
Austin Wiggins
@austinwiggins
Jul 28 2017 19:53
@sjames1958gm I'm afraid I don't understand
Stephen James
@sjames1958gm
Jul 28 2017 19:53
@alexjschiffer Check your devtools console there is an error in winner - which throws and exception which skips the alert
Corentin Whyte
@CorySW
Jul 28 2017 19:54
bootstrap is easy to master I think @ankur1163
I cannot do that tic tac toe challenge easily I don't know exactly what to do
or how to do it
Kelechi Chinaka
@ke1echi
Jul 28 2017 19:56
:wave: @sjames1958gm
Stephen James
@sjames1958gm
Jul 28 2017 19:57
@austinwiggins Move weatherF and isC to a more global location (outside of the getJSON), so your click handler can access
then something like this
$(".clickme").on("click", function() {
    if (isC) {
       // convert weatherF to F and update HTML
   } else {
      // convert to weatherF C and update HTML
   }
   isC = !isC
}
@kelechy :wave:
Alex Schiffer
@alexjschiffer
Jul 28 2017 19:57
@sjames1958gm Thank you!
CamperBot
@camperbot
Jul 28 2017 19:57
alexjschiffer sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8184 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jul 28 2017 19:57
@alexjschiffer When something odd is happening - ALWAYS - check your devtools console!
Austin Wiggins
@austinwiggins
Jul 28 2017 19:58
@sjames1958gm I'll try that. Thanks!
CamperBot
@camperbot
Jul 28 2017 19:58
austinwiggins sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8185 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Kelechi Chinaka
@ke1echi
Jul 28 2017 19:58
function isIsogram(str) {
  var isogram = str.slice(); //original copy
  isogram = isogram.split('').filter((element) => {
    return isogram.indexOf(element) === isogram.lastIndexOf(element);
  }).join('');
  return str === isogram
}
isIsogram("moOse")
same chars may not be same case - Expected: 'false', instead got: 'true'
there is something am not seeing @sjames1958gm
Stephen James
@sjames1958gm
Jul 28 2017 19:58
@austinwiggins Standard disclaimer - that code is not warranted against bugs and typos :)
Kelechi Chinaka
@ke1echi
Jul 28 2017 19:58
can you figure it out @sjames1958gm
Stephen James
@sjames1958gm
Jul 28 2017 19:59
@kelechy FYI, strings are not like arrays - you don't need slice to make a copy.
Austin Wiggins
@austinwiggins
Jul 28 2017 19:59
@sjames1958gm I should keep it inside of the document.ready(function) though, right?
Stephen James
@sjames1958gm
Jul 28 2017 20:00
@austinwiggins For scoping reasons yes.
Ankur sharma
@ankur1163
Jul 28 2017 20:00
@kelechy there are lot of classes in bootstrap
i guess i should read the entire documentation?
Alex Schiffer
@alexjschiffer
Jul 28 2017 20:00
@sjames1958gm Something I will definitely remember after this incident! lol
Stephen James
@sjames1958gm
Jul 28 2017 20:00
@alexjschiffer :+1: :)
Austin Wiggins
@austinwiggins
Jul 28 2017 20:00
@sjames1958gm ok
Kelechi Chinaka
@ke1echi
Jul 28 2017 20:00
slice makes a copy @sjames1958gm
Stephen James
@sjames1958gm
Jul 28 2017 20:01
@kelechy For strings, simple assignment makes a copy.
@kelechy isogram = str this makes a copy because strings are primitives.
Well, since they are immutable it doesn't even matter.
@kelechy moOse should be false because there are two Os?
Kelechi Chinaka
@ke1echi
Jul 28 2017 20:02
no need, just find the parts you need to make you work and focus more on programming lang @ankur1163
dont matter, slice does same @sjames1958gm
Ankur sharma
@ankur1163
Jul 28 2017 20:03
ok thanks @kelechy
CamperBot
@camperbot
Jul 28 2017 20:03
ankur1163 sends brownie points to @kelechy :sparkles: :thumbsup: :sparkles:
:cookie: 292 | @kelechy |http://www.freecodecamp.com/kelechy
Stephen James
@sjames1958gm
Jul 28 2017 20:03
@kelechy Do you need to toLowerCase() the string?
Kelechi Chinaka
@ke1echi
Jul 28 2017 20:03
so what am i missing @sjames1958gm
Austin Wiggins
@austinwiggins
Jul 28 2017 20:03
@sjames1958gm so I should put my code in the function getWeather() but not in the other the ajax function, correct?
Kelechi Chinaka
@ke1echi
Jul 28 2017 20:04
i toLowerCase() and another test broke @sjames1958gm
Stephen James
@sjames1958gm
Jul 28 2017 20:04
@kelechy I don't know all the rules then.
@austinwiggins It doesn't need to be.
Austin Wiggins
@austinwiggins
Jul 28 2017 20:05
But it can be?
Kelechi Chinaka
@ke1echi
Jul 28 2017 20:06
do u need the kata link? @sjames1958gm
Stephen James
@sjames1958gm
Jul 28 2017 20:06
@austinwiggins Yes, the click handler would need to be as well. Just so they both can access the variables.
@kelechy Sure -
Austin Wiggins
@austinwiggins
Jul 28 2017 20:07
ok
:)
Stephen James
@sjames1958gm
Jul 28 2017 20:11
@kelechy Did you var isogram = str.toLowerCase(); so filtered version and unfiltered version are both lower
@kelechy
function isIsogram(str){
  return str.toLowerCase().split("").filter((s, i, a) => a.lastIndexOf(s) == i).join("") === str.toLowerCase();
}
@kelechy Yours is close, just make sure both strings you compare are lower case
Kelechi Chinaka
@ke1echi
Jul 28 2017 20:15
i did quite follow @sjames1958gm
Stephen James
@sjames1958gm
Jul 28 2017 20:15
@kelechy did or didn't?
omarraza
@omarraza
Jul 28 2017 20:16

Finders Keepers.

  var num = 0;
  var a;
  var remainder = arr.filter(func);

  for (var i = 0; i < remainder.length; i++){
    if (remainder[i] % 2 === 0){
      num = remainder[i];
      break;
    }
    else {
      return a;
    }
  }
  return num;
}

I don't understand why return a is returning 0 instead of undefined

Kelechi Chinaka
@ke1echi
Jul 28 2017 20:16
didn't @sjames1958gm
teevik
@teevik
Jul 28 2017 20:16
@sjames1958gm lol, i just finished the same and mine is pretty much 100% same as yours
Stephen James
@sjames1958gm
Jul 28 2017 20:17
var str = str.toLowerCase; 
var isogram = str.split('') // then your filter
return str === isogram
omarraza
@omarraza
Jul 28 2017 20:17
oh duh
Stephen James
@sjames1958gm
Jul 28 2017 20:17
@kelechy Make sure your two strings to compare at the end are both all lowercase
omarraza
@omarraza
Jul 28 2017 20:17
nvm my question, the answer just slapped me in the face
Stephen James
@sjames1958gm
Jul 28 2017 20:18
@omarraza :) :palm_tree:
teevik
@teevik
Jul 28 2017 20:18
By the way, you could also use .every instead of .filter
Kelechi Chinaka
@ke1echi
Jul 28 2017 20:18
ok @sjames1958gm ..fixed..ty
@sjames1958gm ty
CamperBot
@camperbot