These are chat archives for FreeCodeCamp/HelpJavaScript

15th
Sep 2017
Joseph
@revisualize
Sep 15 2017 01:28
Wow.
Dead room.
Stephen James
@sjames1958gm
Sep 15 2017 01:30
crickets
Ronique Ricketts
@RoniqueRicketts
Sep 15 2017 01:32
Chirp chirp. Moooo, meow, bark bark.
silver537
@silver537
Sep 15 2017 02:48
saw blades tearing up flesh
Music to my ears. :3
CamperBot
@camperbot
Sep 15 2017 02:48
silver537
@silver537
Sep 15 2017 02:49
No not
Cbot D:
CamperBot
@camperbot
Sep 15 2017 02:49
you called?
silver537
@silver537
Sep 15 2017 02:49
NO
Eric Hasegawa
@EricHasegawa
Sep 15 2017 05:19
Is anyone online that can help with a quick problem?
Markus Kiili
@Masd925
Sep 15 2017 05:23
@EricHasegawa I can try.
Eric Hasegawa
@EricHasegawa
Sep 15 2017 05:29
@Masd925 Figured out one of the issues and I'm calling it a night, thanks anyway though
CamperBot
@camperbot
Sep 15 2017 05:29
erichasegawa sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4483 | @masd925 |http://www.freecodecamp.com/masd925
LovingVi
@LovingVi
Sep 15 2017 06:02
help!!!
function steamroller(arr) {
var Str = arr.join("-");
return Str.replace(/[[|]|-|,|\"]/g,"-").split("-");
}
steamroller([1, [2], [3, [[4]]]]);
result is [ '1', '2', '3', '4' ]
where this ' from?
Markus Kiili
@Masd925
Sep 15 2017 06:03
@LovingVi Turning an array into a string is a bad idea here.
Could work nicely with an arrays of numbers, but the elements can be anything and the solution fails to work with objects.
Description doesn't state what the elements can be.
LovingVi
@LovingVi
Sep 15 2017 06:06
0.0 I know
THK
Petru Conduraru
@bluecondor
Sep 15 2017 07:13
Hello
How do I use condition here to parse only positive integer? :(
[4, 5.6, -9.8, 3.14, 42, 6, 8.34].map((filter) => 2 * parseInt(filter))
How do I exclude from here the negative number?
Markus Kiili
@Masd925
Sep 15 2017 07:16
@bluecondor What are you exactly trying to do?
Petru Conduraru
@bluecondor
Sep 15 2017 07:17
I need to compute the square of only positive integers of an array
using arrow function syntax
my syntax is squaring and printing a new array, but with the negative values
I need to ignore those
I guess I must have an if condition on the right side
but I don't manage to find the proper one
Markus Kiili
@Masd925
Sep 15 2017 07:19
@bluecondor First use .filter(...) to filter in only the values you wan't to use for calculation.
Petru Conduraru
@bluecondor
Sep 15 2017 07:19
you mean to switch map with filter?
Markus Kiili
@Masd925
Sep 15 2017 07:19
Then you can use .map(...) to square the number. Yes first filter and then map.
Petru Conduraru
@bluecondor
Sep 15 2017 07:43
I'm working on it, coming back soon.
@Masd925 Thank you alot for the suggestion
CamperBot
@camperbot
Sep 15 2017 07:44
bluecondor sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4487 | @masd925 |http://www.freecodecamp.com/masd925
Petru Conduraru
@bluecondor
Sep 15 2017 08:22
@Masd925 finaly I figured it out :). Thank you again for showing me the path!
CamperBot
@camperbot
Sep 15 2017 08:22
bluecondor sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
api offline
Markus Kiili
@Masd925
Sep 15 2017 08:22
@bluecondor :+1:
Petru Conduraru
@bluecondor
Sep 15 2017 08:23
[4, 5.6, -9.8, 3.14, 42, 6, 8.34].filter((num) => num > 0 && num % 1 === 0).map((num) => Math.pow(parseInt(num) ,2));
Markus Kiili
@Masd925
Sep 15 2017 08:34
@bluecondor Do you need the parseInt there?
Petru Conduraru
@bluecondor
Sep 15 2017 08:34
no, it is redundant ofc
I forgot it there from the previous snippet of my code
It should be like this:
.filter((num) => num > 0 && num % 1 === 0).map((num) => Math.pow(num ,2));
Ogundele Olumide
@Lumexralph
Sep 15 2017 12:13
@Masd925 Hey Bro! :wave:
Jake
@JakeDVirus
Sep 15 2017 12:29
i have added a class via jquery $img.attr({src: logo, "class": "logo-offline"}); in line-20.
and the classlogo-offline has the rule { border-radius: none; border: none !important; padding: 10px;}in line-124. But this style rule of logo-offline is not being executed.
Also by doing inspect elementin the debug mode i also cross verified the insertion/addition of logo-offline class in the target element and the mentioned class do exist in the element so i presume the issue is not with the jquery statement but with css .
i thought first that there might be a specificity issue but then i used the keyword !important but still the rule is not being executed
https://codepen.io/neel111/pen/rGVaNX?editors=0110
can anyone help me figure this out?
Markus Kiili
@Masd925
Sep 15 2017 12:33
@Lumexralph Hi.
Blauelf
@Blauelf
Sep 15 2017 12:39
@NeelDVirus /*-------Miscellaneous syles----------*/ not /*-------Miscellaneous syles*/----------, the dashes at the end are interpreted as the start of the next selector.
Jake
@JakeDVirus
Sep 15 2017 12:41
@Blauelf Oh Fish :D :D Thank you again for helping me out. i wonder why my debugging view can't see those.
CamperBot
@camperbot
Sep 15 2017 12:41
neeldvirus sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4605 | @blauelf |http://www.freecodecamp.com/blauelf
Jake
@JakeDVirus
Sep 15 2017 12:41
it screwed my 1hour :D
Blauelf
@Blauelf
Sep 15 2017 12:49
The dashes in codepen were slightly differently coloured.
image.png
Jake
@JakeDVirus
Sep 15 2017 13:12
yeah and my eyes missed that
Pagnito
@Pagnito
Sep 15 2017 15:32
anyone can help me with game of life?
Morchid Chellali
@Morched23MJ
Sep 15 2017 19:02
Anyone could help me understand and implement the Minimax algo for TTT project?
Andrew Parker
@AndrewHParker
Sep 15 2017 19:11
Anyone know of any references that show good examples of practicle uses for JS?
Andrew Parker
@AndrewHParker
Sep 15 2017 19:17
@janelledement do you know of any references that show good examples of practicle uses for JS?
Jake
@JakeDVirus
Sep 15 2017 19:40

in my ajax call, there seems to be a sligth delay in appending the retrieved element after the loading animation gets removed. the delay is slight but enough to make it feel weird. the snippet for this context is below.

    $.ajax({
       //code block
    }).done(function(){
        $("#loader-block").addClass("display-none");
        $(".wrapper_streamers-blocks").removeClass("hidden");
    });

https://codepen.io/neel111/pen/yzNxVw
how can i make this trasition between removing of the loading animation and appending of the element at the same time.

Augustas
@AugustasV
Sep 15 2017 19:41

https://www.freecodecamp.org/challenges/stand-in-line

item=arr.push(6);
  item=arr.shift(0);

Push is working, but whats wrong with shift? I dont want to see spoiler.

Utkarsh Gupta
@UtkarshGupta-CS
Sep 15 2017 19:42
"{"statusCode":400,"error":"Bad Request","message":"The user already exists.","errorCode”:"some_error"}"
How can parse this to JSON? I used JSON.parse but it’s not working?
Moisés Man
@moigithub
Sep 15 2017 19:42
shift dont uses any values, it will ignore whatever u pass
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:43
do you havea link @UtkarshGupta-CS
?
Augustas
@AugustasV
Sep 15 2017 19:43
@moigithub not that
Moisés Man
@moigithub
Sep 15 2017 19:44
well syntactically there are no errors on those 2 lines @AugustasV
Augustas
@AugustasV
Sep 15 2017 19:44
function nextInLine(arr, item) {
  // Your code here
   item=arr.push(6);
  item=arr.shift();
  return item;  // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:44
maybe you wanna do item +1
Pieter Stokkink
@forkerino
Sep 15 2017 19:44
@AugustasV perhaps you need to push something other than 6
Utkarsh Gupta
@UtkarshGupta-CS
Sep 15 2017 19:45
@tiagocorreiaalmeida i tried this in JSBIN
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:45
can you send a link then?
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:45
hey @forkerino it's been a while
Moisés Man
@moigithub
Sep 15 2017 19:45
instead of harcoding 6 inside ur function... use the vaiable/argument passed @AugustasV
Utkarsh Gupta
@UtkarshGupta-CS
Sep 15 2017 19:45
Let me check how can I share that
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:46
I think you can give me just the jsbin
and I will be avaible to see it right there
so you have to push the value into the end o the array
Pieter Stokkink
@forkerino
Sep 15 2017 19:46
@tiagocorreiaalmeida yeah, every time I come here there's almost no one here. I don't really stick around when it is so quiet.
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:46
arr.push itme IO guess?
Pieter Stokkink
@forkerino
Sep 15 2017 19:47
how are you?
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:47
and then they askk you to remove the first value from that array so you allready knwo what to do
Utkarsh Gupta
@UtkarshGupta-CS
Sep 15 2017 19:47
Jason Luboff
@JLuboff
Sep 15 2017 19:47
@forkerino :wave: I'm always lurking
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:48
great, got a bit lost on what to learn once I ended fcc frontend, still a bit lost tbh,and you?how's work going?
Pieter Stokkink
@forkerino
Sep 15 2017 19:48
@JLuboff heyhey!
Jason Luboff
@JLuboff
Sep 15 2017 19:49
Whats happening?
Utkarsh Gupta
@UtkarshGupta-CS
Sep 15 2017 19:49
console.log(JSON.parse(`"{"statusCode":400,"error":"Bad Request","message":"The user already exists.","errorCode”:"some_error"}"`))
Manish Giri
@Manish-Giri
Sep 15 2017 19:49
@JLuboff :wave:
@forkerino :wave:
Jason Luboff
@JLuboff
Sep 15 2017 19:49
@Manish-Giri Another lurker from the depths of code
Pieter Stokkink
@forkerino
Sep 15 2017 19:49
@tiagocorreiaalmeida work is good, but it's keeping me busy during the days and at night I usually don't want to spend a lot of time behind my computer
Manish Giri
@Manish-Giri
Sep 15 2017 19:49
@JLuboff :smiling_imp:
Utkarsh Gupta
@UtkarshGupta-CS
Sep 15 2017 19:49
Any help on above query its not working
Pieter Stokkink
@forkerino
Sep 15 2017 19:49
@Manish-Giri :metal:
Jason Luboff
@JLuboff
Sep 15 2017 19:50
Anybody want to share my :birthday: :cake: ?
Stephen James
@sjames1958gm
Sep 15 2017 19:50
@UtkarshGupta-CS You need to use single quotes around the whole thing
Manish Giri
@Manish-Giri
Sep 15 2017 19:50
@JLuboff give this a shot
gone are the days of parseInt()
@JLuboff happy birthday :cake:
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:51
you have aswell some bad "
trying to correct it
Utkarsh Gupta
@UtkarshGupta-CS
Sep 15 2017 19:52
@sjames1958gm I tried that here http://jsbin.com/zeqopix/edit?js,console check it out
Jason Luboff
@JLuboff
Sep 15 2017 19:52
@Manish-Giri Thanks
CamperBot
@camperbot
Sep 15 2017 19:52
jluboff sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6540 | @manish-giri |http://www.freecodecamp.com/manish-giri
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:52
@forkerino just the usual after starting working in something you like then you use the rest of the time to do others things, learning alot?
Stephen James
@sjames1958gm
Sep 15 2017 19:52
@UtkarshGupta-CS You had a bad quote (some special character not ") at the end of error_code
@UtkarshGupta-CS "errorCode” << this is not a "
Manish Giri
@Manish-Giri
Sep 15 2017 19:53
@JLuboff how old did you become?
Pieter Stokkink
@forkerino
Sep 15 2017 19:53
@JLuboff HBD
Jason Luboff
@JLuboff
Sep 15 2017 19:53
@Manish-Giri 29 ...getting old :joy:
@forkerino Thanks
CamperBot
@camperbot
Sep 15 2017 19:53
jluboff sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 2931 | @forkerino |http://www.freecodecamp.com/forkerino
Pieter Stokkink
@forkerino
Sep 15 2017 19:53
@tiagocorreiaalmeida Learning a ton.
Manish Giri
@Manish-Giri
Sep 15 2017 19:53
@JLuboff wow you're just 29?
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:53
@UtkarshGupta-CS there's a error on this part
"errorCode”
Pieter Stokkink
@forkerino
Sep 15 2017 19:54
@Manish-Giri is that a way to say he looks old?
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:54
beside that trying to figure out the rest
Utkarsh Gupta
@UtkarshGupta-CS
Sep 15 2017 19:54
@tiagocorreiaalmeida i fix that still not working
Jason Luboff
@JLuboff
Sep 15 2017 19:54
@Manish-Giri What'd you think I was 40? :P
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:54
what are you using that?what kind of frameworks and stuff?just curious
Pieter Stokkink
@forkerino
Sep 15 2017 19:54
@sjames1958gm :wave:
Manish Giri
@Manish-Giri
Sep 15 2017 19:54
well no, but he's married @forkerino
Tiago Correia
@tiagocorreiaalmeida
Sep 15 2017 19:54
on work
@UtkarshGupta-CS yeah I know, sec
Stephen James
@sjames1958gm
Sep 15 2017 19:55
@forkerino :wave:
@UtkarshGupta-CS console.log(JSON.parse('{"statusCode":400,"error":"Bad Request","message":"The user already exists.","errorCode":"some_error"}'))
Jason Luboff
@JLuboff
Sep 15 2017 19:55
I married young :)
Manish Giri
@Manish-Giri
Sep 15 2017 19:55
niice
lucky you
Utkarsh Gupta
@UtkarshGupta-CS
Sep 15 2017 19:56
@sjames1958gm thanx
CamperBot
@camperbot
Sep 15 2017 19:56
utkarshgupta-cs sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8466 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Jason Luboff
@JLuboff
Sep 15 2017 19:56
@forkerino Any luck finding a place closer to work?
Pieter Stokkink
@forkerino
Sep 15 2017 19:58
@JLuboff I'll hear on monday whether we get a certain place. It's good for now, not too big, but big enough and pretty close to the sea.
Jason Luboff
@JLuboff
Sep 15 2017 19:58
Awesome
3lfind
@3lfind
Sep 15 2017 20:44
hi, I am stuck on the word blanks. Is anyone can help?
kumquatfelafel
@kumquatfelafel
Sep 15 2017 20:44
yup
3lfind
@3lfind
Sep 15 2017 20:44

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";

return result;
}

wordBlanks("dog", "big", "ran", "quickly"); /

legendinraze
@legendinraze
Sep 15 2017 20:54
what's wrong?
function testLogicalAnd(val) {
  // Only change code below this line

  if (val>=50 && val<=25) {
      return "Yes";

  }

  // Only change code above this line
  return "No";
}

// Change this value to test
testLogicalAnd(10);
kumquatfelafel
@kumquatfelafel
Sep 15 2017 20:55

The values "dog", "big", "ran", and "quickly" are being passed into myNoun, myAdjective, myVerb, and myAdverb respectively. Your goal is to use those parameters to form a sentence. There needs to be a space between each of these words... beyond that, you're free to create pretty much any sentence you want provided you use the values in myNoun, myAdjective, etc.

For example, you could have a result like The big smelly dog ran out of the barn quickly. if you wanted. You could even have big dog ran quickly.

You just can't have, e.g. bigdogranquickly

Reviewing these two challenges may also be helpful.

https://www.freecodecamp.org/challenges/constructing-strings-with-variables and https://www.freecodecamp.org/challenges/concatenating-strings-with-plus-operator

@3lfind
legendinraze
@legendinraze
Sep 15 2017 20:56
Never mind I figured it out
kumquatfelafel
@kumquatfelafel
Sep 15 2017 20:56
@legendinraze have to be careful with direction of signs. ;)
legendinraze
@legendinraze
Sep 15 2017 20:56
@kumquatfelafel Yup
It was actually the numbers that were in the wrong place @kumquatfelafel
Jason Luboff
@JLuboff
Sep 15 2017 20:58
@Manish-Giri I have a solution to that kata, but its 2 characters too long..
Manish Giri
@Manish-Giri
Sep 15 2017 20:59
@JLuboff yeah I had that too to begin with
Jason Luboff
@JLuboff
Sep 15 2017 20:59
@Manish-Giri x=(a,b)=>+a+(+b)
Manish Giri
@Manish-Giri
Sep 15 2017 20:59
using + to turn it into int
Jason Luboff
@JLuboff
Sep 15 2017 20:59
So...hmmm
Manish Giri
@Manish-Giri
Sep 15 2017 20:59
but had to look for other ways
sigh
Jason Luboff
@JLuboff
Sep 15 2017 21:00
Did you get it?
kumquatfelafel
@kumquatfelafel
Sep 15 2017 21:00
what kata is this?
Manish Giri
@Manish-Giri
Sep 15 2017 21:00
yup
Jason Luboff
@JLuboff
Sep 15 2017 21:00
@Manish-Giri Hint?
Manish Giri
@Manish-Giri
Sep 15 2017 21:00
@JLuboff you'll need -
then you can solve it with or without +
in the acceptable limit
Jason Luboff
@JLuboff
Sep 15 2017 21:01
....
3lfind
@3lfind
Sep 15 2017 21:01
@kumquatfelafel thanks a lot
CamperBot
@camperbot
Sep 15 2017 21:01
3lfind sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 626 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
kumquatfelafel
@kumquatfelafel
Sep 15 2017 21:02
np
Jason Luboff
@JLuboff
Sep 15 2017 21:06
@Manish-Giri Bigger hint? Lol
kumquatfelafel
@kumquatfelafel
Sep 15 2017 21:06
and link? ;)
legendinraze
@legendinraze
Sep 15 2017 21:08
function testElse(val) {
  var result = "";
  // Only change code below this line

  if (val > 5) {
    result = "Bigger than 5";
  }

  if (val <= 5) {
    result = "5 or Smaller";
  }

  // Only change code above this line
  return result;
}

// Change this value to test
testElse(4);
caI don't get it
Jason Luboff
@JLuboff
Sep 15 2017 21:08
@Manish-Giri Nevermind, got it
Manish Giri
@Manish-Giri
Sep 15 2017 21:08
@JLuboff awesome
legendinraze
@legendinraze
Sep 15 2017 21:09
Combine the if statements into a single if/else statement.
Jason Luboff
@JLuboff
Sep 15 2017 21:09
@Manish-Giri I used a -= but I guess that wasn't necessary
Manish Giri
@Manish-Giri
Sep 15 2017 21:09
yeah probably